Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts2 annotation - validation for spaces to be allowed in name

 
Krishan Babbar
Greenhorn
Posts: 6
  • 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: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic