File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Murach's Java Servlets and JSP this week in the Servlets 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.
 
 
subject: Struts2 Regex Validation killing me, Please help
 
Similar Threads
validation in struts2
Struts2 Field Validator in XML - regex issue
Struts2 (2.1.8.1) Checkbox/Radio button validaton
Struts 2 Validation Problem
validation problem for cost : struts2