struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Giri Alwar" <gal...@hotmail.com>
Subject Re: Re: questions about struts validator
Date Thu, 16 Jan 2003 02:35:06 GMT
> This is the scenario that I was trying to figure out.
> Suppose in the struts config file I've defined a form bean name
"logonForm"
> and an action named "/logon" which uses "logonForm". And suppose that
> in validate.xml I've defined
>   <formset>
>     <form name="logon">
>        ...
>     </form>
>     <form name="logonForm">
>        ...
>     </form>
>   </formset>
>

The first form entry does not make sense. The name attribute in the form
element should be the logical name you assigned to the form bean in the
Struts config file and not the action name.

> When the user clicks on a button that triggers a form submit
> via the logon action...  What validation takes place?
>
> Maybe my question should be:  When does validation for form bean
> gets triggered?  Is it any time that an action uses it or?
>

Since I don't know what your action mapping entry looks like, I will make a
couple of  assumptions in addition to what you have stated: validation is
enabled and the form bean is in request scope.

Suppose that a request arrives for the "/logon" action path. Struts will
first look for an attribute in the request called "logonForm" (by default
Struts stores your form bean as an attribute using the same name as the
logical name you gave it). In this case, it will not find your form bean in
the request. Struts will therefore create an instance of your form bean,
store it in the request as an attribute under the name "logonForm", call the
reset method on it, populate it with request parameters that match setters
in your form bean and finally call the validate method on your form bean. If
validation succeeds (the validate method returns null or an empty
collection), Struts will then call the execute method on the associated
Action object. Every time a request arrives for the "/logon" action path,
this sequence will repeat.




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.435 / Virus Database: 244 - Release Date: 12/30/2002

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message