I've solved this problem a couple of different ways.
1) Turn off validation in the struts-config and handle it within your
action method. Something like:
ActionErrors errors = form.validate(mapping, request);
if (errors != null && !errors.isEmpty()) {
saveErrors(request, errors);
return mapping.findForward("error_or_form");
}
2) Create an <action .../> for each dispatch within your struts-config.
Something like:
<action path="/EmailEvent"
type="...EmailDispatch"
name="emailEventForm"
scope="request"
input="emailEventForm.jsp"
parameter="method"
validate="true">
</action>
<action path="/EmailDispatch"
type="...EmailDispatch"
name="emailAllUsersForm"
scope="request"
input="/pages/emailAllUsersForm.jsp"
parameter="method"
validate="true">
</action>
If you're going to go with route number 2, then I'd say use
MappingDispatchAction instead. But, I think that means you would need
to use Struts 1.2.x.
- Dave
> -----Original Message-----
> From: Nadia Kunkov [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 04, 2004 11:28 AM
> To: Struts help (E-mail)
> Subject: Dispatch Action and Validate - rephrased subject
>
> I rephrased the subject of this posting. The old one was really
wrong.
>
>
>
> Hi,
> I'm building an application using DispatchAction. I have several
screens that use the same
> ActionForm and I set validate to "true" for this action form.
> The first page of my app is just a jsp with a single button ( I have
to start somewhere :) . When I
> click the button on this first page which is not the form and has no
input fields, I guess Struts
> tries to validate it. What I see in the log is that I do get into the
validate method, the
> validation fails and the action itself is not performed. How can I
tell struts to not validate this
> first page but validate other screens where there are input fields.
Since I use dispatch action I
> can't specify validate "false" for some actions and "true" for the
others, it's just one validate...
> That brings me to the next question. Should I use DispatchAction?
> Thanks for your help.
> NK
>
> ---------------------------------------------------------------------
> 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]