Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Carry values between page submit

 
sri pathi
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
sri pathi
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic