Hi,

Could someone tell me does struts2 support it?

Regards
LV




________________________________
From: "mailtolouis2020-str...@yahoo.com" <mailtolouis2020-str...@yahoo.com>
To: Struts Users Mailing List <user@struts.apache.org>
Sent: Thu, January 21, 2010 12:24:13 PM
Subject: [S2] Validation - globally define regex

Hello,

In struts 1, I can define the regex in one file like this

<constant>
<constant-name>alphaNumeric</constant-name>
<constant-value>[A-Za-z0-9]*</constant-value>
</constant>

and use like this in
<var>
<var-name>mask</var-name>
<var-value>${alphaNumeric}</var-value>
</var>


Could anyone tell me how to achieve this in Struts 2 ?

I've this in validation rule and I want to put the regex in another variable, I 
tried used <constant> tag, but it not accept < >.

<field name="name">
<field-validator type="requiredstring">
<message key="@Lerror.required"/>
</field-validator>
<field-validator type="regex">
  <param name="expression">
   <![CDATA[[A-Za-z0-9]*]]>
  </param>
  <message key="@Lerror.invalid"/>
</field-validator> 
</field>

Thanks
LV

Reply via email to