You're instantiating an ArrayList, not a Person object. -----Original Message----- From: Nima Boustanian [mailto:[EMAIL PROTECTED] Sent: Friday, March 10, 2006 12:03 PM To: Tapestry users Subject: Re: @Persist("problems")
Oki - so this is what I have classes/META-INF/hivemodule.xml //With some help from Tongs book... <?xml version="1.0"?> <module id="org.project.web.tapestry4.pages" version="1.0.0"> <contribution configuration-id="tapestry.state.ApplicationObjects"> <state-object name="person" scope="session"> <create-instance class="java.util.ArrayList"/> </state-object> </contribution> </module> //Home.java @InjectState("person") public abstract Person getPerson(); public abstract void setPerson(Person person); ... person = getPersonManager().getPersonByUsername(yahooUsername); setPerson(person); cycle.activate(main); //Main.java public abstract Person getPerson(); public abstract void setPerson(Person person); //Main.html <span jwcid="@Insert" value="ognl:person.username"/> Still no output though, person.username = null... I know that the property is there because I can set it manually if I do nextpage.setPerson(person); Anything I've missed maybe??? Thanks! James Carman wrote: >If you want something to be shared across pages, you have to use an >Application State Object (session scoped of course). > >-----Original Message----- >From: James Carman [mailto:[EMAIL PROTECTED] >Sent: Friday, March 10, 2006 11:23 AM >To: 'Tapestry users' >Subject: RE: @Persist("problems") > >It persists it in the session for that specific page. > >-----Original Message----- >From: Nima Boustanian [mailto:[EMAIL PROTECTED] >Sent: Friday, March 10, 2006 11:21 AM >To: Tapestry users >Subject: Re: @Persist("problems") > >Maybe I am way off here, but @Persist("session") should save the content >throughout the session right? It might be difficult to determine >what's wrong with the code if you just see it by mail, but I've grasped >the concept correctly haven't I? Maybe I should just go back to >my deprecated visit class :p > > >Nima Boustanian wrote: > > > >>Hey all >> >>I am trying to get the @Persist annotation to work but no dice :( >>I can output the person.username in Main.html but the component in >>Main.html - Placeholder.html - can't output it. >>Am I doing something wrong with the @Persist annotation? As you can >>see I've included it in both Home.java and >>Main.java just as a safety-newbie-move, but it still won't output >>anything! Main.html can output person.username because >>of "nextpage.setPerson(person)" but if I remove the line " >>nextpage.setPerson(person); " person will be null and Tapestry will >>throw an exception. >> >>Is there anything else that I have forgotten that is required to make >>@Persist work? Thanks! >> >>//Home.java >>@Persist("client") >> public abstract Person getPerson(); >> public abstract void setPerson(Person person); >> >>public IPage onSubmit(IRequestCycle cycle) { >>... >>setPerson(person); //Doesn't work >>nextpage.setPerson(person); >>cycle.activate(main); >>} >> >> >>//Main.html >><span jwcid="@Insert" value="ognl:person.username"/> //Will output the >>username >> >>//Main.java ("this is the nextpage") >>@Persist("client") >>public abstract Person getPerson(); >>public abstract void setPerson(Person person); >> >> >>//Placeholder.java ("a component in Main") >>public abstract Person getPerson(); >> >>//Placeholder.html >><span jwcid="@Insert" value="ognl:person.username"/> //Doesn't work >> >> >> >> >>--------------------------------------------------------------------- >>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] > > > >--------------------------------------------------------------------- >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]