wood burning stoves 2.0*
The moose likes Struts and the fly likes Problem while Navigation in Struts. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem while Navigation in Struts." Watch "Problem while Navigation in Struts." New topic
Author

Problem while Navigation in Struts.

Priya Jotwani
Ranch Hand

Joined: Oct 30, 2002
Posts: 53
I have 4 JSP pages in my application. Saying Next leads me to the next JSP Page and Cancel always takes me to the first JSP page with default values loaded.Saying Previous takes me to the previous page with the selected values restored.
All this is to implemented using Struts ,having a Single Action Class and a Single Form Bean.
My Page 1 contains 2 Combo Boxes
My Page 2 contains 2 Listboxes. The user selects some items of List 1 and moves into List 2. Saying Next should save the List 2 and take me to Page 3.
Page 3 again has exactly the same scenario as Page 2 .Saying Next takes me to Page 4.
Page 4 again contain 2 Combo Boxes.
I should go on appending the field values of Pages I navigate in the Request so that its available in my Formbean. So in my Action class I get the request parameter values of Page 1 and set it again in the Request .In Page 2, I have a hidden variable corr. to fields of Page 1 and I assign the values by doing request.getAttribute.
How should I do the same thing for storing my Listbox values of Page 2 in the request and then how do I retrieve the same in Page 3 ?

Thanks in Advance,
Priya
Eusebio Floriano
Ranch Hand

Joined: Mar 07, 2004
Posts: 235
Why dont you put it in the session ?
I would solve your problem.


SCJP 1.4 / 5.0 - SCBCD 1.3 - SCWCD 1.4 - IBM 484
sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415
Hi priya

In the above cases its always better to store the values in session mean make the scope of the form bean session and at any time clean that once if u want.............see the best example in all the commercial websites where u do online purchase will be 4-5 step process but at the end they will give the summary in one page (all the parameters in the 4-5 step process) i all these cases the data will be persisted in session

that too placing 4-5 lists wont affect ur performance too
Priya Jotwani
Ranch Hand

Joined: Oct 30, 2002
Posts: 53
Thanks for the Reply.
but my problem is that I CANNOT put it in Session(not my decision )
The main thing I am stuck is I don't know how to pass the list from Page 2 so that it is avaialble in subsequent request. I want it the way I am retrieving the value of combo in Action class by saying request.getParameter() and then again setting it in the Request so that it is avaialable in the next page.
Any ideas how this could be done ?
Also, would like to know if there is Listbox tag in Struts ?

TIA,
Priya
Rovas Kram
Ranch Hand

Joined: Aug 08, 2003
Posts: 135
Priya, correct me if I'm wrong but isn't your question just a basic servlet question? How do you get the values selected by the user in ListBox? I mean if you knew, you would just pass those values to the next page using request.setAttribute, right?
[ September 01, 2004: Message edited by: Rovas Kram ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem while Navigation in Struts.
 
Similar Threads
Struts 1.1: Help needed with html:select, html:options, html:optionsCollection
Populating the Combo Box using AJAX
Retrieving values of the Previous page in Struts
doubt about request
combo boxes and iterator