| Author |
Pass data between managed/ backing beans
|
Anoop V. Kumar
Greenhorn
Joined: Jan 21, 2006
Posts: 18
|
|
I have a simple application with 3 pages and there is a backing bean for each page say page1-bb1, page2-bb2 and page3-bb3. The value selected in page1 by the user is actually the input to displaying results in the page2 and again value from page2 is inout to page3. My question is what is the best way to pass these values/data between page1 and bean2 and page2 and bean3?? Is it really necessary that all managed beans for this application to work are in session scope? Thanks in advance, Anoop
|
 |
Sergey Smirnov
Ranch Hand
Joined: May 29, 2003
Posts: 167
|
|
If you need to pass data from page1 to page2 or page2 to page3 you can use a request scope bean. However if you want to pass data from the page1 to the page3 without using (showing, storing) it on the page2, you have to have the session scope. take a look at http://jsffaq.com/Wiki.jsp?page=HowToAccessOneManagedBeanFromAnotherManagedBean for ways how to access one bean from the another one. I suggest, in your particular case, when each page has the own backing bean, the right way is using the reference bean. Actually, you can access the page1bean from the page2bean because if it is still alive, but this break the architecture idea. -- Sergey : http://jsfTutorials.net
|
 |
Anoop V. Kumar
Greenhorn
Joined: Jan 21, 2006
Posts: 18
|
|
Thanks a TON Sergey... Phew - I never knew this place existed - it is like a treasure house - I am hoping to implement almost every thing that is discusssed in the faq - Thanks again... -Anoop
|
 |
Anoop V. Kumar
Greenhorn
Joined: Jan 21, 2006
Posts: 18
|
|
Can you further help me with one thing that I am struggling... I have a page (call it page1 using the backing bean bb1) where a user selects a value. Now I need to send the user to page2 (using bb2) AND I need to send the value that the user selected to the bb2... how can I do that.. Basically my question now is how do I send data from a jsp page to a backing bean that the jsp page does not use?? Thanks, Anoop
|
 |
 |
|
|
subject: Pass data between managed/ backing beans
|
|
|