If you declare you property, Tapestry will dynamically create a page classe derived from your class and override your getters and setters to use a generated instance variable which it manages.
So, - drop your field "invoice" - declare the getters & setters of invoice abstract - access invoice only via accessors - init it with an "initialize" attribute in your .page and you should be fine. > -----Original Message----- > From: Andrew B [mailto:[EMAIL PROTECTED] > Sent: Monday, November 07, 2005 12:23 PM > To: [email protected] > Subject: persistent property doesn't work! Help! > > > I am trying to get a simple persistent property to > work in a page in Tapestry 4, with no luck at all. The > error message is: > > Unable to read OGNL expression '<parsed OGNL > expression>' of [EMAIL PROTECTED]: source is null > for getProperty(null, "amount") > > pointing to a component binding: > > <binding name="value" value="ognl:invoice.amount" /> > > So, invoice is coming back null for some reason > (amount is just a double in invoice, with a simple > getter, so it can't be that). Property declaration: > > <property name="invoice" persist="session" /> > > In Home.java, it is initialized in pageBeginRender: > > public void pageBeginRender(PageEvent pageEvent) > { > invoice = new Invoice(); > invoice.setLineItems(new HashSet()); > System.out.println("pageBeginRender called, invoice > = " + invoice); > } > > This is definitely getting called, as I see the > debugging output. Invoice is initialized. But, I also > put a debugging line in the getter for invoice: > > public Invoice getInvoice() > { > System.out.println("getInvoice() = " + invoice); > return invoice; > } > > and it never seems to be getting called. > > If I take the property declaration for invoice out > entirely, the page works, but then of course when I go > to submit it, the original invoice has been lost when > I go to submit the page, because it isn't persistent. > Tapestry is making me tear my hair out. Any help is > appreciated, thanks in advance. > > > > __________________________________ > Yahoo! FareChase: Search multiple travel sites in one click. > http://farechase.yahoo.com > > --------------------------------------------------------------------- > 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]
