You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Raghuveer <ra...@infotechsw.com> on 2006/02/20 08:19:08 UTC

validator frame work for struts Action Errors

Is it possaible to use Validator framework for Struts  Action Errors.
My requirement is to validate my JSP page with Action Errors .
I have 10 fields in my JSP page.
Once the user enters some fields and submit the page , My ActionForm need to
validate the fields and if any errors in JSP,i need to send all action erros
to JSP page.

Example:

First name is required
Phone Number should be numeric
Email is Invalid.

Experts please suggest me!!


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


Re: validator frame work for struts Action Errors

Posted by Dharmendra Singh <ni...@gmail.com>.
Hi Dear

there is no need to use validator framwork for ActionErrors.
Strusts .jar is sufficient.
just use validate() in Action Form which returns ActionErrors
and use .properties file for mapping corresponding Errors.

If U satisfied my Answer or U got another problem.
Plz mail me.........

bye
Dharmendra Singh


On 2/20/06, vasumathi <va...@koensoft.com> wrote:
>
>
> u can use like this in validation.xml file in WEB-INF folder.
> <form name="loginForm">
>         <field property="userName"
> depends="required,minlength,maxlength,mask">
>                <arg0 key="login.enter.user"/>
>                        <var>
>                <var-name>minlength</var-name>
>                                <var-value>5</var-value>
>                        </var>
>                        <var>
>                <var-name>maxlength</var-name>
>                                <var-value>12</var-value>
>                        </var>
>                        <var>
>                <var-name>mask</var-name>
>                                <var-value>^[0-9_a-zA-Z]*$</var-value>
>                        </var>
>                 </field>
>         <field property="userPassword" depends="required">
>                 <arg0 key="login.enter.password"/>
>         </field>
>      </form>
> no need to use validate method in ActionForm.
> i think u know the use of validator-rules.xml in WEB-INF folder.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: validator frame work for struts Action Errors

Posted by vasumathi <va...@koensoft.com>.
u can use like this in validation.xml file in WEB-INF folder.
<form name="loginForm">
         <field property="userName" 
depends="required,minlength,maxlength,mask">
         	<arg0 key="login.enter.user"/>
			<var>
            	<var-name>minlength</var-name>
				<var-value>5</var-value>
			</var>
			<var>
            	<var-name>maxlength</var-name>
				<var-value>12</var-value>
			</var>
			<var>
            	<var-name>mask</var-name>
				<var-value>^[0-9_a-zA-Z]*$</var-value>
			</var>
		 </field>
         <field property="userPassword" depends="required">
         	 <arg0 key="login.enter.password"/>
         </field>
      </form>
no need to use validate method in ActionForm.
i think u know the use of validator-rules.xml in WEB-INF folder.


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