Just for balance ;-) I'll also point out that you don't *have* to disable automatic validation to achieve your goal; there are approaches that will allow you to retain that functionality, too.

One possibility is to point the 'input' attribute to the same DispatchAction and have one of the methods in that determine which JSP to forward to.

L.

Chris Cheshire wrote:
Thank you for your help, I'll give all this a try :)

Chris

On 3/2/06, Michael Jouravlev <[EMAIL PROTECTED]> wrote:
On 3/2/06, Chris Cheshire <[EMAIL PROTECTED]> wrote:
Thanks Michael, both of those are helpful.

I have a few extra questions though:

Regarding ActionDispatcher -
* The ParameterListActionDispatcher class isn't in the 1.2.8 struts
distribution that I downloaded, and is linked as a bugfix. Do I need
to download the entire struts source, add this in and recompile, or is
there an easier way?
ParameterListActionDispatcher is a proposal for upcoming Struts
release. The more people use it and find it useful, the more chances
that it will be included. So, try it and vote for it if you like it:
http://issues.apache.org/bugzilla/show_bug.cgi?id=38343 I hope you
will like it, I think it is the best known solution for event dispatch
in Struts.

If you use Struts 1.2.7+, all you need is only
ParameterListActionDispatcher class. Download it and compile it along
with your project. If you use older Struts version than you will need
base ActionDispatcher as well, but nothing more.

Regarding DataEntryForm -
* In sections 6 & 7 it describes a class
ParameterMappingDispatchAction that I also don't see in the
distribution (nor in the javadocs online). Is this referring to the
ParameterListActionDispatcher class or something else? Conceptually it
seems to be describing the same thing. If not is there an example of
what step 7 is describing?
Right, I have to fix that. ParameterMappingDispatchAction was an
initial patch, then Paul went with ParameterListActionDispatcher which
is better because you can use any Action class, you do not have to
derive your Action from some other dispatch class anymore. So
disregard ParameterMappingDispatchAction, I will fix the wiki page
later.

All that aside, when I turn off automatic validation, can I still call
the validation manually in my action code? ie. Something like :

ActionErrors errors = form.validate(mapping, request);
if (!errors.isEmpty()) {
    // determine which forward key to use based upon which step I am
in the process
    forward = mapping.findForward(forwardKey);
    saveErrors(request, errors);
    return forward;
}
Of course. This is exactly how you do it, perfect.

Is there anything else I need to do to validate the form manually?
No. You may want to check errors for null, but it depends on how you
implemented validate() method.

Michael.

---------------------------------------------------------------------
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]

Reply via email to