How can I pass a dynamic backing bean into a JSF 2.0 page using facelets?
Posted
by kgrad
on Stack Overflow
See other posts from Stack Overflow
or by kgrad
Published on 2010-04-21T14:36:59Z
Indexed on
2010/04/21
15:13 UTC
Read the original article
Hit count: 353
Hi,
I am using a JSF 2.0 to create a web app (purely jee6, without spring/seam etc.). I would like to have a single xhtml page but pass the proper backing bean / entity into it. For example, I would like to be able to edit a user other than the logged in user, I have a user edit page which displays the information of the logged in user (being tracked by my session), I would like to instead pass in a user selected from a list and edit that user's information, without switching the user that is stored in the session or creating a separate xhtml page (violating DRY).
The "best" way I can see to achieve this would be to reuse the exact same xhtml page that I am using to display the logged-in-user's edit page, but simply pass in a different entity in some way. Perhaps calling the setter in the backing bean before redirecting to the page (if this is even possible) or some other solution that does not violate DRY. Perhaps I have designed this all wrong, is there a way to pass in entities to JSF pages?
thanks.
© Stack Overflow or respective owner