www.pudn.com > struts2.rar > RegisterAction-validation.xml, change:2009-08-19,size:3023b


<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> 
 
<validators> 
 
	<!-- 非字段校验 
	<validator type="requiredstring"> 
		<param name="fieldName">username</param> 
		<message>username should not be blank!</message> 
	</validator> 
 
	<validator type="stringlength"> 
		<param name="fieldName">username</param> 
		<param name="minlength">1</param> 
		<param name="maxlength">10</param> 
		<message>username should be ${minlength} and ${maxlength}</message> 
	</validator> 
	--> 
 
	<field name="username"> 
		<field-validator type="requiredstring" short-circuit="false"> 
			<param name="trim">true</param><!--是否去掉两边空格,默认为true--> 
			<message key = "username.xml.invalid"></message> 
		</field-validator> 
		 
		<field-validator type="stringlength"> 
			<param name="minLength">1</param> 
			<param name="maxLength">10</param> 
			<message>username should be ${minLength} and ${maxLength}</message> 
		</field-validator> 
	</field> 
	 
	<field name="password"> 
		<field-validator type="requiredstring"> 
			<param name="trim">true</param><!--是否去掉两边空格,默认为true--> 
			<message>"password" name should not be blank!</message> 
		</field-validator> 
		 
		<field-validator type="stringlength"> 
			<param name="minLength">6</param> 
			<param name="maxLength">18</param> 
			<message>password should be ${minLength} and ${maxLength}</message> 
		</field-validator> 
	</field> 
	 
	<field name="repassword"> 
		<field-validator type="requiredstring"> 
			<param name="trim">true</param><!--是否去掉两边空格,默认为true--> 
			<message>"repassword" name should not be blank!</message> 
		</field-validator> 
		 
		<field-validator type="stringlength"> 
			<param name="minLength">6</param> 
			<param name="maxLength">18</param> 
			<message>repassword should be ${minLength} and ${maxLength}</message> 
		</field-validator> 
	</field> 
	 
	<field name="age"> 
		<field-validator type="int"> 
			<param name="min">1</param> 
			<param name="max">150</param> 
			<message>age name should be ${minLength} and ${maxLength}</message> 
		</field-validator> 
	</field> 
	 
	<field name="birthday"> 
		<field-validator type="required"> 
			<message>birthday should not be blank!</message> 
		</field-validator> 
		<field-validator type="date"> 
			<param name="min">1910-01-01</param> 
			<param name="max">2020-12-30</param> 
			<message>birthday should be ${minLength} and ${maxLength}</message> 
		</field-validator> 
	</field> 
 
	<field name="graduation"> 
		<field-validator type="required"> 
			<message>graduation should not be blank!</message> 
		</field-validator> 
		<field-validator type="date"><!-- 可以为null --> 
			<param name="min">1910-01-01</param> 
			<param name="max">2020-12-30</param> 
			<message>graduation should be ${minLength} and ${maxLength}</message> 
		</field-validator> 
	</field> 
 
</validators>