struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yaroslav Novytskyy <sp_ynovyts...@n-ix.com.ua>
Subject Validator inheritance
Date Fri, 20 May 2005 15:25:40 GMT
Hi!

Does anyone know about the way to "inherit" (1) and "reuse" (2) 
validations for multiple forms in validation.xml
Explanation:
1.
I have a number of myForms: myForm1, myForm2, and so on they are of 
class MyForm (so they all have same fields) and I want them to validate 
the same.
e.g.
<form name="myForm1, myForm2">
	<field
		property="elementIndex"
		depends="integer">
		<arg0 key="Element index" resource="false"/>
	</field>
</form>

2.
When I inherit MyExtForm from MyForm adding some fields and make 
form-beans myExtForms: myExtForm1, myExtForm2, and so on and would like 
them to "inherit" validation definitions from MyForm.

<form name="myExtForm1" extends="myForm1">
	//!!!validation for elementIndex field
	//already inherited!!!
	<field
	   property="subElementIndex"
	   depends="required">
	   <arg0 key="Sub element index" resource="false"/>
	</field>
</form>

Yaroslav Novytskyy
P.S.
this would "compress" size of the validator.xml file
(in my case 10-20 times!)

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


Mime
View raw message