In S2 your JSP is accessing the value stack. Lets say you only need one
bean for all the information your wizard collects (I'll use person as an
example)
eg. <s:textfield name="person.firstName">
It's your action's responsibility to ensure the same person instance is
being updated if you're accessing different properties of person across
multiple requests.
The simplest way to do this implement SessionAwareAction and put person
in the session map provided. Implement Preparable to get it from the
session before the setter(s) are called.
With this approach you can use a single action and it'll be very short
and simple. I'd include a different method for next, back, cancel and
complete.
If you don't want to use the session, and don't want to persist it, you
can't really avoid passing all properties of person with each request.
Either use the hidden fields individually or encode/serialize it into a
cookie or single hidden parameter.
Personally, as your wizard is only 3 pages and it sounds like no
workflow is involved, I think the javascript suggestion to show/hide a
few divs was a good one.
Charbel Abdul-Massih wrote:
In the struts 1 world, we used to have one form in the session...With
each subsequent page in the flow, part of the form is
populated...Whenever any page in the flow is requested, the state is
kept and the form variables are retrieved or updated accordingly...
Is there a similar way to do this in Struts 2???
-----Original Message-----
From: Al Sutton [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 24, 2007 11:36 AM
To: 'Struts Users Mailing List'
Subject: RE: Best practice - Wizard flow
As I see it the problem with that approach is if I'm at stage 3, I got
back
two screens to stage 1, change something, when I click next I've lost
all
the previously entered data in step 2.
-----Original Message-----
From: Marco Carnevale [mailto:[EMAIL PROTECTED]
Sent: 24 May 2007 16:34
To: Struts Users Mailing List
Subject: Re: Best practice - Wizard flow
How about this. Each subsequent page in the wizard contains all the new
form elements plus html hidden form elements for the previous save.
This
way you are hitting the sever between requests and not using the
session.
Each wizard screen is basically the 'state' for itself plus all previous
screens.
Marco
On 5/24/07, Dave Newton <[EMAIL PROTECTED]> wrote:
--- Charbel Abdul-Massih wrote:
I would have thought that something as simple as a wizard would be
easily doable...I would like to keep
away from the session as much as possible...
The thing with "wizards" (at least as I've used and implemented them)
is that previous steps in the wizard flow should be easily accessible,
and the easiest way to do that is via the session... otherwise you
have to make intermediate saves (which is also a fine
solution) and reloads when you go back (or forward) in the process.
Just a thought.
d.
______________________________________________________________________
______________
TV dinner still cooling?
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]