In your pageBeginRender metod write the following code :
if (searchInvoice==null){
SearchInvoice searchInvoice = new SearchInvoice();
searchInvoice.setCustomer = new Customer();
}
I use this type of code to initialize properly my componentes.
What do you say ?
-----Mensagem original-----
De: Kristian Marinkovic [mailto:[EMAIL PROTECTED]
Enviada em: sexta-feira, 17 de março de 2006 12:46
Para: Tapestry users
Assunto: initializing object in page
hi,
can someone help me with my newbie problem:
i have two pages: a master and a detail page. The master page offers you some
possibilities to enter different criterias for a search.
As i want to use Hibernates query-by-example i write something like that:
...
<component id="search_id" type="TextField">
<binding name="value" value="searchInvoice.id" />
</component>
<component id="customer_lastname" type="TextField">
<binding name="value" value="searchInvoice.customer.lastname" />
</component>
...
the java class provides following method:
...
public abstract Invoice getSearchInvoice(); public abstract void
setSearchInvoice(Invoice invoice); ....
Because the Customer within the Invoice is null i get a ognl exception:
Unable to read OGNL expression '<parsed OGNL expression>' of
[EMAIL PROTECTED]: source is null for getProperty(null,
"lastname")
My question is as follows:
- How do I initialize my Invoice object properly ? (initialize method is
deprecated)
- Should I use Hivemind to initialize my obejcts to have it injected like:
@InjectState("searchInvoice") and how can i do this?
- Should I use a @Bean instead and how can i initialize that?
greetings,
kris
---------------------------------------------------------------------
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]