You have to define separate action mappings for each forward in order for
the validation to behave properly. Each mapping needs its own input forward
to use Struts' validation framework. 

This seems to be a recurring problem that new users attempting to utilize
DispatchAction with validation meet up with. The architecture of
DispatchAction would quite naturally lead a developer to put several
forwards into one mapping if they are related in some fashion, using the
DispatchAction to facilitate the command design pattern. It works very well
until validation of user input is necessary. Since validation relies on the
input attribute of the mapping, and a mapping can only have one input, every
forward in that mapping will display the same view defined by that input if
a validation error occurs. I don't believe that the original intentions
behind using DispatchAction accounted for this usage and the problems that
it introduces. But since this seems to be a common problem (just search the
archives), maybe there should be an attempt to address it.

Larry

-----Original Message-----
From: Joel Hainley [mailto:[EMAIL PROTECTED]
Sent: Monday, June 23, 2003 10:56 AM
To: Struts Users Mailing List
Subject: RE: DispatchAction and input


Hmmmm....

I suppose that setting place to go back to in the validate() method would
work, except that I have defined a single actionForm class that i utilize in
all pages, another "benefit" of dispatch actions and this would require me
to determine what action i was validating before making a decision in the
validate method of the form, and that doesn't seem to be very good design to
me.



-----Original Message-----
From: Wendy Smoak [mailto:[EMAIL PROTECTED]
Sent: Monday, June 23, 2003 7:52 AM
To: 'Struts Users Mailing List'
Subject: RE: DispatchAction and input


Joel wrote:
> I guess that's the root of my problem.
> The place that it should go to when validation fails is
> different for each method. I would always want it to go
> back to the page that was submitted to produce the error

I've never tried this, but... 'ActionMapping mapping' is part of the
signature of the validate method.  Would it be possible to override
validate() and call mapping.setInput("whatever.jsp") before calling
super.validate()?

Worth a try, I guess.  Although "go back where you came from" is a common
Struts problem.  I just put a value in the request or session, but that may
not appeal to everyone.

--
Wendy Smoak
Applications Systems Analyst, Sr.
Public Affairs, Information Resources Management
Arizona State University, Tempe AZ


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


*************************************************************************** 
This electronic mail transmission contains confidential and/or privileged 
information intended only for the person(s) named.  Any use, distribution, 
copying or disclosure by another person is strictly prohibited. 
*************************************************************************** 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to