Hello All,

I'm trying to use the Struts validator but it doesn't seem to be working in
my - relatively common - case.

I have a modify.jsp page that is displayed upon calling
/modifyAction?command=init (using the DispatchAction). No validation must be
performed at this point. The user then enters some data and submits the form
to /modifyAction?command=update and at this point I clearly want the
validation to be performed. I also have a search page that can be called
with /modifyAction?command=search (no validation, of course).

How can I do this?

I've tried the following:
- myForm extends ValidatorForm and <form name="myForm ...> in
validation.xml. 
This doesn't work as the form is validated on the init method (the blank
modify.jsp is displayed the first time with an error message saying "field
required" as the validation is performed on the form)
- myForm extends ValidatorActionForm and <form name="/modifyAction" ...> in
validation.xml
This doesn't work because when I call the search page with
/modifyAction?command=search, the validation is triggered (it matches
"/modifyAction") and doesn't allow me to go to the search page until the
data is valid (which doesn't really make sense since I want to select
something).

Do you have any suggestions? Is there a way I can do the above with the
Struts validator? Am I structuring my actions in the wrong way? I think I
need a "DispatchValidatorForm"... :)

Thank you for any help.

Andrej

Reply via email to