You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rafael Taboada <ka...@gmail.com> on 2005/05/06 21:09:56 UTC

Validations

 Hi dear Struts list friends.

 I have several JSPs and all them map only one actionform. All work
fine, in my actionform i have all attributes they appear in my JSPs.

 The problem is when i want to validate some input. For example in a
JSP i have two forms and when i want to work with only the first one,
i want to validate its attributes. I use the validate method in my
actionform, but there is an error because it validates all atributes
in my jsp and of course because I want to work with only one form, all
attributes of the another form has to be blank and this is the error.

 Is it correct to have only one actionform for many JSPs??

 How can i validate my attributes with this approach?.

 thanks for your cooperation

-- 

 Rafael Taboada

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


Re: Validations

Posted by Michael Jouravlev <jm...@gmail.com>.
I guess, there are other ways, but these are off the top of my head.

* Define a hidden field in each form with the same name, but different
value. In the validate() method check value of the Java field, which
corresponds to hidden HTML field. Validate accordingly.

* for multiform page you can use DispatchAction or
LookupDispatchAction, set "validate=false" in your action mapping, and
validate manually from button handler. You can have custom validation
methods for each button.

Michael.

On 5/6/05, Rafael Taboada <ka...@gmail.com> wrote:
>  Hi dear Struts list friends.
> 
>  I have several JSPs and all them map only one actionform. All work
> fine, in my actionform i have all attributes they appear in my JSPs.
> 
>  The problem is when i want to validate some input. For example in a
> JSP i have two forms and when i want to work with only the first one,
> i want to validate its attributes. I use the validate method in my
> actionform, but there is an error because it validates all atributes
> in my jsp and of course because I want to work with only one form, all
> attributes of the another form has to be blank and this is the error.
> 
>  Is it correct to have only one actionform for many JSPs??
> 
>  How can i validate my attributes with this approach?.
> 
>  thanks for your cooperation
> 
> --
> 
>  Rafael Taboada

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