Seen today your mail and followed your words. A lot of changes later I just have an ASO problem... My dispatcher (http://wiki.apache.org/tapestry/Tapestry5HowToControlAccessbased) sets the objects in ASM (this.asm.set() ) successfully. But my meta-class wich has @ApplicationState(create=false) to this class, always returns null.
What may be the problem? A few snippers to help out: MyContext.java: @ApplicationState(create=false) protected Clientes cliente; private boolean clienteExists; public AllertContext() { System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>"); System.out.println(this.cliente); //returns null } AccessController.java: if(ret.size() == 1) { this.asm.set(Clientes.class, ret.get(0)); } else { this.asm.set(Clientes.class, null); } Index.java @ApplicationState @Property private MyContext context; public Object onActivate() throws IOException { if(context.hasCliente()) return Pesquisa.class; return null; } On Wed, Jan 21, 2009 at 3:37 PM, Thiago H. de Paula Figueiredo < thiag...@gmail.com> wrote: > Em Wed, 21 Jan 2009 10:59:41 -0300, Sid Ferreira <sid....@gmail.com> > escreveu: > > 1) Create a MyContextService, wich has an ApplicationState object >> > > Tapestry-IoC services cannot use the @ApplicationState annotation. If they > need to access ASOs, they need to use the ApplicationStateManager. > > 2) Create a @Private annotation (Dispatcher docs, but not clear how to >> finish it) >> > > It can be any annotation you fancy. @Private was just the name the wiki > article author chose. > > 3) Create 2 pages, one to login and another to list, wich extends >> MyContextService >> > > Pages can't be services, but they can use them (through @Inject). > > 4) Create a dispatcher, wich extends MyContextService >> > > The dispatcher would use your service, not extend it. > > the idea: >> 1) Dispatcher is called, identify the client and set/reset it >> 2) If user is logged (didn't decided this part yet) it validates the >> Client >> - User relation >> 3) If not logged, check if has a submit and try to login >> 4) If now the user is not logged, forward in server side to the login >> 5) Dispatcher forward to list >> > > It seems ok. > > So, the questions: >> 1) How to finish up the @Private? ( >> http://wiki.apache.org/tapestry/Tapestry5HowToControlAccess) I dunno what >> to >> ser in the type for instance >> > > This annotation is just a marker. Annotations can't have code nor logic. > Reading your "1 week of Tapestry" message, I got the impression that you're > not familiar with Java yet. Therefore, I strongly suggest you to really > understand Java before learning Tapestry. You must really understand OOP and > Java to use Tapestry really well. > > 2) How to server-side forward? >> > > RTFM! (hehehe, sorry, I coundn't resist) > http://tapestry.apache.org/tapestry5/guide/pagenav.html. > > 3) Using ASO (or AOS?) in a super class, isn't the same (and so useless to >> do) to have a protected static property in MyContextService? >> > > ASOs must be private fields, but you can write a protected getter. ;) > A static property in a service would be just one variable for the whole > application. As you need separate state (session) for each user, it must be > an ASO. > > -- > Thiago H. de Paula Figueiredo > Independent Java consultant, developer, and instructor > http://www.arsmachina.com.br/thiago > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Sidney G B Ferreira Desenvolvedor Web - Tibox Innovations