Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4272

Add a fieldKey attribute to validators

    XMLWordPrintableJSON

Details

    Description

      Taking into account that in the struts2 taglib a field usually has a name and a key (for its label), why there isn't also a fieldKey in validators?

      For example, you have the following field in JSP:

      <s:textfield name="name" key="personalData.name"/>
      

      and then in the Action (ModelDriven) :

      @RequiredStringValidator(type = ValidatorType.SIMPLE, fieldName = "model.name", key = "errors.required")
      

      so you have to add to the .properties file personalData.name and also name. I would prefer something like:

      @RequiredStringValidator(type = ValidatorType.SIMPLE, fieldName = "model.name", fieldKey = "personalData.name", key = "errors.required")
      

      Am I missing something? If not, why does not exist the fieldKey in validators?

      Thank you in advance

      Attachments

        Activity

          People

            Unassigned Unassigned
            cococo42 cococo42
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: