This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes Struts2 Regex Validation killing me, Please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 Regex Validation killing me, Please help" Watch "Struts2 Regex Validation killing me, Please help" New topic
Author

Struts2 Regex Validation killing me, Please help

Prav Chau
Ranch Hand

Joined: Jul 17, 2007
Posts: 58
Hi Friends,

I am trying to use regex for normal string validation. Tried various regular expression but struts2 validation didn't work for me. In below example I am trying to validate string which will have only Capital letters A to Z. Can anyone help me to find correct regular expression for validating string with special characters.

<field name="regexValidatorField">
<field-validator type="regex">
<param name="expression"><![CDATA[[A-Z]]]></param>
<message><![CDATA[ regexValidatorField must have all capilate A- Z characters ]]></message>
</field-validator>
</field>


Prav Chau
SCJP, SCWCD, SCBCD, SCEA, http://pravinchaudhari.blogspot.com/
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

That regex is only for a single character.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts2 Regex Validation killing me, Please help