Hi Peter,

If you just want UserData to be an ASO, there's only one step (in your
page/component class):

@ApplicationState
private UserData userData;

You don't need to bind anything.  So its actually easier than 'too
easy to be true' :).

Here's a good starting point:
http://tapestry.apache.org/tapestry5/tapestry-core/guide/appstate.html

The 'scope' Kristian mentioned, i believe, is a reference to different
persistence strategies for ASOs, the default of which is to store it
in the http session.

In fact i wouldn't use the word scope in that context since it's
easily confused with service scopes in tapestry-ioc, which is an
altogether different concept:
http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html
(see section 'Defining Service Scope')

Cheers,
lasitha.

On 10/8/07, Peter Stavrinides <[EMAIL PROTECTED]> wrote:
> Okay so let me get this straight:
>
> Step1 bind (it has a default scope of session):
>
> binder.bind(UserData.class).withId("DataService")
>
> Step2:
>
> @Inject
> private UserData userData_;
>
> And that's it?? that seems almost too easy to be true!
>
>
> Kristian Marinkovic wrote:
> > and you can also have services withouth an interface
> >
> > binder.bind(UserData.class).withId("DataService")
> > will also work :)
> >
> >
> >
> >
> > Kristian Marinkovic <[EMAIL PROTECTED]>
> > 08.10.2007 14:29
> > Bitte antworten an
> > "Tapestry users" <users@tapestry.apache.org>
> >
> >
> > An
> > "Tapestry users" <users@tapestry.apache.org>
> > Kopie
> >
> > Thema
> > Antwort: Re: Tapestry 5 IoC container
> >
> >
> >
> >
> >
> >
> > in T5 you don't have to define ASOs as in T4
> >
> > if you want to define and use a ASO you just have
> > to use the @ApplicationState annotation:
> >
> > @ApplicationState
> > private UserData userData;
> >
> > the first access will force the object instantiation with
> > a no-arg constructor. default scope of ASOs (and the only
> > possible at the moment) is "session".
> >
> > if you need global ASOs you can define a service in your
> > AppModule and inject it as you did below.
> >
> > g,
> > kris
> >
> >
> >
> >
> > Peter Stavrinides <[EMAIL PROTECTED]>
> > 08.10.2007 14:20
> > Bitte antworten an
> > "Tapestry users" <users@tapestry.apache.org>
> >
> >
> > An
> > Tapestry users <users@tapestry.apache.org>
> > Kopie
> >
> > Thema
> > Re: Tapestry 5 IoC container
> >
> >
> >
> >
> >
> >
> > Actually I am migrating a lot of code from T4
> >
> > Typically I have many Pojos used as services like this one:
> >
> > public class UserData implements Serializable {
> >     ....
> >     public UserData() {
> >     }
> > }
> >
> > This is an ASO session scoped in T4. In T5 in AppModule.java I have
> > added a binder entry:
> >
> > binder.bind(UserData.class, UserDataImpl.class).withId("DataService");
> >
> > UserData is expected as an interface though in T5, how do I convert
> > them, do have to write wrappers for all my services? what is the
> > efficient approach here?
> >
> > I am injecting services in T5 like this, I don't know if this is correct
> > though?
> >
> >     @Inject
> >     private RequestGlobals globals_;
> >
> >     @Inject
> >     private UserData userData_;
> >
> > Thanks
> > Peter
> >
> > Robin Helgelin wrote:
> >
> >> On 10/8/07, Peter Stavrinides <[EMAIL PROTECTED]> wrote:
> >>
> >>
> >>> Hi All,
> >>>
> >>> Sorry if this is a trivial question, I am looking for samples or a
> >>> tutorial explaining how to use Tapestry 5 IoC. I have been through the
> >>> documentation on site and there are some details I can't figure out.
> >>>
> >>>
> >> It's easier to help you if you tell us the details :)
> >>
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to