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

add support for OGNL to all field-validator params

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.9
    • 2.1.8
    • Expression Language
    • None

    Description

      XWork bug reproduced here, please remove if appropriate

      Param values cannot contain ognl values, here is my current validator configuration.
      The ognl possibility in th message is very usefull, it is a pity we cannot do the same on the param side ...

      <field name="language.name">
      <field-validator type="requiredstring" short-circuit="true">
      <message>${getText("validator.requiredstring"}</message>
      </field-validator>
      <field-validator type="stringlength">
      <param name="maxLength">255</param>
      <message>${getText("validator.stringlength"}</message>
      </field-validator>
      </field>

      here is what I wish I could do

      <field name="language.name">
      <field-validator type="requiredstring" short-circuit="true">
      <message>${getText("validator.requiredstring"}</message>
      </field-validator>
      <field-validator type="stringlength">
      <!-- here is the requested change--> <param name="maxLength">${getText("maximum.length.language.locale")}</param>
      <message>${getText("validator.stringlength"}</message>
      </field-validator>
      </field>

      Attachments

        Activity

          People

            lukaszlenart Lukasz Lenart
            framiere Florent Ramière
            Votes:
            3 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: