• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to preserve bean values across pages?  RSS feed

 
Thanigaivel Soundararajan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am bit new to struts however I learnt few concepts.

Now i am trying to implement the following scenario

1. Initial JSP page should display 2 text fields (say fname, lname) and a (next)button

2. On clicking the next button in step1 i should display another JSP page with 2 text fields (say address, phone) and one (next)button

3. On clicking the next button in step2 I should display the inputs given in page 1 and 2 (steps1&2)

I am through steps 1 and 2 however I am facing trouble with step 3. whenever i click on the next button the input i gave was lost.

I am using single formbean and action class for this requirement

please guide me to fulfill this requirement

Also, let me know if you need more details.

Thanks,
Thani
 
Stevi Deter
Ranch Hand
Posts: 265
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without seeing the classes and your action mappings, it's hard to identify what the real cause of the problem is.

One place to check is the scope of your action mapping for the actions. If you have it set to request, for example, and are not including the previously entered data in your forms, you may lose it.
 
Bhaskar Reddy
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Stevi put it, check your action mapping scope definition... I believe we need to set the scope as session (unless you are planning to set the previously entered data manually in both the Action class and JSP)..

do post your code snippet for action mapping so we can better assist...
 
Thanigaivel Soundararajan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Stevi and Bhasker.

As you both replied I replaced the scope from "request" to "session" and the application works as desired.

Thanks for your help...
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!