File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Carry values between page submit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Carry values between page submit" Watch "Carry values between page submit" New topic
Author

Carry values between page submit

sri pathi
Greenhorn

Joined: Jul 15, 2008
Posts: 28
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.
Darryl Nortje
Ranch Hand

Joined: Jun 11, 2002
Posts: 140
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.
sri pathi
Greenhorn

Joined: Jul 15, 2008
Posts: 28
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 ]
Venkat Sadasivam
Ranch Hand

Joined: May 10, 2008
Posts: 139
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.


“Any fool can write code that a computer can understand. Good programmers write code that humans can understand. ”<br>
-Martin Fowler
sri pathi
Greenhorn

Joined: Jul 15, 2008
Posts: 28
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 ]
 
 
subject: Carry values between page submit