-
1. Re: Creat and parameter injection
accless Sep 18, 2008 12:39 PM (in response to bashan)This is a correct and logical behavior.
Your Create-Method is invoked, right after SEAM instantiated your Component! When your Component is created, the request values have not been applied yet!the workflow for a get-Request:
- incoming Request to server
- seam-instantiates all necessery components (referenced in your xhtml and pages.xml)
- start of normal jsf-lifecylce (applyValues from Request, validation, etc.) and scanning of pages.xml
greetings
-
2. Re: Creat and parameter injection
bashan Sep 18, 2008 6:39 PM (in response to bashan)Thanks,
I pretty much know that in this phase apply value has not taken place yet. But I though this is the whole idea behind there param. Having the parameter values ready for you.
For this reason obviously I will be using RequestParameter annotation instead. and here comes the question: why not always use RequestParameter? The parameter is the always from the very begining, so why use param in pages.xml which limits you in case of Create annotation? -
3. Re: Creat and parameter injection
accless Sep 19, 2008 11:09 AM (in response to bashan)Dont forget.
each (Ajax-)Request to your sfsb/pojo will cause seam to inject the request-Parameter again and again.
Annotate your set-Method with a RequestParameter Annotation and u can preserve your (initial) request-parameter very easily. This is especially helpful, if your sfsb/pojo contains some methods, which are invoked via AJAX (its not always sure (more or less a pitfall) that the ajax-request encode the Request-Parameter again and again)
@RequestParameter
public void setRequest(Long idXXX) {
if (idXXX != null)
this.idXXX = idXXX;
}
greetings -
4. Re: Creat and parameter injection
accless Sep 19, 2008 11:10 AM (in response to bashan)i forgot to mention, even if u use RequestParameter-Annotation, the values are applied after the creation of your bean!