*
The moose likes Struts and the fly likes Struts2 annotation - validation for spaces to be allowed in name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 annotation - validation for spaces to be allowed in name " Watch "Struts2 annotation - validation for spaces to be allowed in name " New topic
Author

Struts2 annotation - validation for spaces to be allowed in name

Krishan Babbar
Greenhorn

Joined: Aug 30, 2010
Posts: 6
I am using annotations for validations in my struts2 based application. I want to allow the spaces between company name to user. I was trying following expressions but these are not working... Please let me know what symbol should I use in expression for allowing spaces:

@RegexFieldValidator(fieldName = "company.name", expression = Constants.COMPANY_NAME_EXPRESSION , key = "errors.company.name.format", message = "errors.company.name.format"),

where i tried following for COMPANY_NAME_EXPRESSION

String COMPANY_NAME_EXPRESSION = "^([a-zA-Z0-9@_.-
s]+)$"
and
String COMPANY_NAME_EXPRESSION = "^([a-zA-Z0-9@_.-\\\\s]+)$"

Thanks
Krishan Babbar
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts2 annotation - validation for spaces to be allowed in name