struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mallik <malli...@yahoo.com>
Subject validation framework problem?
Date Tue, 05 Sep 2006 11:05:25 GMT

HI Friends
i am using validation framework with struts at fontend
but the validation is not working properly
first-time validation is taking place at server side ( displaying errors on
window)
second-time onwards it is taking place at client side (getting alert)
why these all?
this is my code:
------------------------------------------------------
struts-config.xml

<form-bean name="LoginForm"
type="org.apache.struts.validator.DynaValidatorForm">
	<form-property name="userId" type="java.lang.String"/>
	<form-property name="password" type="java.lang.String"/>
</form-bean>
.......
.....
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>

------------------------------------------------------
validator.xml

<form  name="LoginForm">
<field property="userId" depends="required,minlength,maxlength">
<arg0 key="label.userId" />
<arg1 key="${var:minlength}" name="minlength" resource="false" />
<var>
<var-name>minlength</var-name>
<var-value>4</var-value>
</var>
<arg2 key="${var:maxlength}" name="maxlength" resource="false"/>
<var>
<var-name>maxlength</var-name>
<var-value>10</var-value>
</var>
</field>
<field property="password" depends="required,minlength,maxlength">
<arg0 key="label.password"/>
<arg1 key="${var:minlength}" name="minlength" resource="false" />
<var>
<var-name>minlength</var-name>
<var-value>4</var-value>
</var>
<arg2 key="${var:maxlength}" name="maxlength" resource="false"/>
<var>
<var-name>maxlength</var-name>
<var-value>10</var-value>
</var>
</field>
</form>
------------------------------------------------------------
resources.properties file

#validator errors
errors.required = {0} is required.
errors.minlength = {0} cann't be less than {1} characters.
errors.maxlength = {0} cann't be more than {2} characters.
errors.invalid = {0} is invalid.

# -- Label messages --
label.userId = User ID
label.password = Password
----------------------------------------------------------------
login.jsp file

<html:javascript formName="LoginForm" dynamicJavascript="true"
staticJavascript="false" />

and i didn't change anything in validation-rules.xml


please let me know where i went worng

Mallik

-- 
View this message in context: http://www.nabble.com/validation-framework-problem--tf2220180.html#a6149898
Sent from the Struts - User forum at Nabble.com.


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


Mime
View raw message