0 Replies Latest reply: Oct 22, 2010 12:31 AM by 807034 RSS

    Struts2 annotation - validation for spaces to be allowed in name

    807034
      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