struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard J. Duncan" <>
Subject RE: validation occuring before form is loaded, why?
Date Tue, 18 Nov 2003 16:32:22 GMT


1.    What version of struts are you working with ?

2.    If the action map's validate attribute is set to true, the
form.validate() method is called *before* the action is executed. If
there are errors it will forward back to the input page (value of the
input attribute).

3.    To avoid having struts call validate for addEdit=add, you need to
either (a) forward to a different action that has validate=false or (b)
check the value of addEdit in your form and don't call the super unless
its 'edit', or (c) use one action map for add and edit and another for
submitting the changes (the latter is the one that should have



Note that you can have multiple actions can be mapped to the same action






-----Original Message-----
From: Janice [] 
Sent: Monday, November 17, 2003 8:04 PM
Subject: validation occuring before form is loaded, why?


Hi Gang,


I was having problems getting validation to work at all.  I've read
every post on getting it to work, followed all step-by-steps, and
nothing would ever do it.  Today I yanked all the .jar files out of my
lib directory and updated it with the .jar files from the latest release
version of struts (1.1).  Well... something started to happen all right,
just not what I expected.


What it looks like its doing is validating my form before its even
loaded (execute() does not get called, and my print statements in
validate() show that super.validate() is returning errors.)


What my code is trying to do is:

1) a list of widgets are displayed.  Each widget has a link to an edit
page.  There is also an add widget option.  Both the edit and the add
call the same action with a request parameter like addEdit=add or


Currently, when either of these links are clicked, I get a 'page cannot
be displayed' and my log tells me that there was a validation error.  I
don't know why validate() is being called in the first place, I have no
explicit calls to it, and didn't expect it to get run until the next
form was submitted and my struts-config.xml said validate=true.


2) the next step should be that the action builds the form object with
either the reset() values for an add, or a database-retrieved set of
values for an edit.  Ideally, when this form is submitted, the form
should be validated.  If I change my validate() method on my form object
to return a new ActionErrors(), then things work better, but still don't


I hope this is enough information.  I can post a bunch of code if its
not.  I really appreciate any and all help, this validation stuff is
taking soooo long to get working!


Thanks in advance,



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message