One of the biggest problems I've faced in moving from Struts to JSF is dealing with the JSF lifecycle. In short, stuff happens to the data in my backing beans and I'm spending too much time trying to get the right data on a page and keep it there, unmolested, throughout the JSF request processing lifecycle.
Here is a simple generic use case on which I'd appreciate some basic JSF advice:
Master-to-Detail Navigation: User clicks on a link on page A. The link passes an id value as a request parm to page B where a query for the details are retrieved and displayed.
Page A uses an HtmlOutputLink component with an enclosed UIParameter control to pass a uniqueId as a request parm to the next page.
The questions I have are for page B's managed bean declared to be in request scope:
1) Where should I get request parm value, and store it, so that it stays available throughout all lifecycle operations on the page?
I've pulled it from the request attributes in the constructor and stored it as a field on the bean, but it seems to get nulled out during a later request processing phase.
2) What do I need to do keep safe the detailed record I get using the unique key passed in as a request parm.
If a validation error is found, the data is still there. However, if I navigate back to that same page (i.e. edit -> invoke save action -> return to page for more edits), that's a new request, so the field reverts to null.
Since JSF posts back to the same page, how do I propagate the uniqueId to the next request (which will be for the same page)?
I know I can keep the bean as a session bean, but I'd like to avoid keeping everything in session just to facilitate what should be (probably is) simple navigation in JSF.
Thanks for any advice.
[ February 15, 2006: Message edited by: madjack ]
[ February 15, 2006: Message edited by: madjack ]