You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de> on 2008/10/09 20:50:42 UTC

Validation of field with dynamic name

Hi,

validation is easy when you know how your field is named:

http://struts.apache.org/2.x/docs/validation.html

But how its done if you don't know it exactly.
E.g. this one:

<s:textfield name="ruleSets[%{#status.index}].rules[%{#rulesStat.index}]" />

You get something like:

ruleSets[0].rules[0].points

I tried 
http://www.opensymphony.com/xwork/wikidocs/Validation Annotation.html

and annotated my Entity Class with @Validation and the setPoints method with a 
IntRangeValidator - but nothing happend.
The xml File needs the fieldName which i don't have. I've got no more ideas (i 
can implement the validate() method and parse all my parameters there, but i 
hope this can be done via framework).
Any help appreciated.

-- 
Bitte senden Sie mir keine Word- oder PowerPoint-Anhänge.
Siehe http://www.gnu.org/philosophy/no-word-attachments.de.html

Really, I'm not out to destroy Microsoft. That will just be a 
completely unintentional side effect."
	-- Linus Torvalds