Passing Object obtained in action method of one JSF view to another
I am fairly new to JSF. Just trying to get a simple application working (which was previously written using another technology).
The situation is that I have people going to starting page and they enter in an email address and we look to see if they are already registered. If they are, we want to redirect them to the registration page with all their information pre-populated in the form using the object we obtained via the search done in the original form's action.
I have a bean called LookupBean which contains emailAddress and an action for "doLookup". We then have a registrationBean which exposes a model object for all relevant registration info (name, phone, email, etc). This registationBean would have a save method, etc.
So, LookupBean is used by lookup.xhtml and Registr开发者_运维问答ationBean is used by register.xhtml.
My question is once I perform the lookup action in the LookupBean via lookup.xhtml and head over to register, how do I make the registrationBean have a reference to the value obtained during the lookup?
It's also important to note, that I expect both of these beans to be view based beans. I suspect one option is to just make the registrationform bean sessions scoped and then it would work.
Hope that makes sense.
Thanks!
with jsf2.0 we have viewscope, you can use it instead taking overhead of session
That's one of the drawbacks of the ViewScope which is solved e.g. by @ViewAccessScoped for JSF + CDI applications. Some days ago I've found interesting information at http://os890.blogspot.com/search/label/ViewScoped.
精彩评论