Forums Register Login

Carry values between page submit

+Pie Number of slices to send: Send
My current code is like there are 3 sequential pages and each page is accessed from the previous/next page by using a combination of submit button and navigation rules. In this case values entered in page 1 and 2 should be available in managed bean of page 3 meaning when i do a submit from page 3 only then they should be sent for back end processing. Until then they will not be stored any where. Currently I am trying to use session scope for each managed bean but with no success as I get null values when i try to access the values entered in page 1 and 2 from the managed bean of page 3.
+Pie Number of slices to send: Send
Howzit Sri,

That's odd, because putting your managed beans into session scope would definitely be the way to achieve what you want.

Please post your code, the faces-config.xml file as well.
+Pie Number of slices to send: Send
 

Originally posted by Darryl Nortje:
Howzit Sri,

That's odd, because putting your managed beans into session scope would definitely be the way to achieve what you want.

Please post your code, the faces-config.xml file as well.



Here's my code. I suspect I'm not accessing the object properties correctly.


I'm not posting my jsp code here. Please let me know if you still need them.
There is h:command button on each page which submits the form and display the subsequent forms, and finally trying to send the values in sendSurvey action method to back end. Please let me know if you need more details.
[ August 04, 2008: Message edited by: sri pathi ]
+Pie Number of slices to send: Send
I see in sendSurvey method you are creating new instance of SiteSurveyPage2 class. Which is wrong. You have to take the one available in session.

You have to make changes in XML and you class file.
<managed-bean>
<managed-bean-name>pc_SiteSurveyPage3</managed-bean-name>
<managed-bean-class>pagecode.SiteSurveyPage3</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<property-name>siteSurveyPage1</property-name>
<value>#{pc_SiteSurveyPage1}</value>
</managed-bean>

In SiteSurveyPage3.java, you must have a getter and setter for variable siteSurveyPage1.

Hope this helps you. You can find more information in google search as well.
+Pie Number of slices to send: Send
 

Originally posted by Venkat Sadasivam:
I see in sendSurvey method you are creating new instance of SiteSurveyPage2 class. Which is wrong. You have to take the one available in session.

You have to make changes in XML and you class file.
<managed-bean>
<managed-bean-name>pc_SiteSurveyPage3</managed-bean-name>
<managed-bean-class>pagecode.SiteSurveyPage3</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<property-name>siteSurveyPage1</property-name>
<value>#{pc_SiteSurveyPage1}</value>
</managed-bean>

In SiteSurveyPage3.java, you must have a getter and setter for variable siteSurveyPage1.

Hope this helps you. You can find more information in google search as well.



Thanks a lot! Venkat. Thanks Darryl!!
[ August 05, 2008: Message edited by: sri pathi ]
Self destruct mode activated. Instructions for deactivation encoded in this tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1684 times.
Similar Threads
Providing anchor to columns in a datatable
Initialising request scoped bean
JSF Questions
storing arbitrary number of values to an arraylist
Initializing request scoped managed bean instance
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 14:37:21.