Source

webwork / webapps / showcase / src / java / com / opensymphony / webwork / showcase / validation / CollectionValidatorExample-validation.xml

<?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="expression">
		<param name="expression"><![CDATA[persons.{#this.name.length() > 4}.{? #this == false }.size() <= 0 ]]></param>
		<message>name needs to be 4 chars long</message>
	</validator>
	<field name="persons">
		<field-validator type="fieldexpression">
			<param name="expression"><![CDATA[persons.{#this.name.length() > 4}.{? #this == false }.size() <= 0 ]]></param>
			<message>name needs to be 4 chars long</message>
		</field-validator>
		<field-validator type="collection">
			<param name="property">persons.name</param>
			<param name="validatorRef">requiredstring</param>
			<param name="validatorParams['defaultMessage']">need to be string</param>
			<message></message>
		</field-validator>
		<field-validator type="collection">
			<param name="property">persons.age</param>
			<param name="validatorRef">required</param>
			<param name="validatorParams['defaultMessage']">need to be filled in</param>
			<message></message>
		</field-validator>
		<field-validator type="collection">
			<param name="property">persons.age</param>
			<param name="validatorRef">int</param>
			<param name="validatorParams['defaultMessage']">need to be integer</param>
			<message></message>
		</field-validator>
	</field>
</validators>