File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts2 annotation - validation for spaces to be allowed in name

 
Krishan Babbar
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic