Uploaded image for project: 'Struts 1'
  1. Struts 1
  2. STR-2312

[validator] Validation message - value, index not accessible

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.2.4
    • Fix Version/s: Future
    • Component/s: Core
    • Labels:
      None
    • Environment:
      Operating System: All
      Platform: All
    • Bugzilla Id:
      32695

      Description

      Unortunately the value and index is not accessible for displaying together with
      the message. For example I would imagine:
      <field property="email" depends="email" indexedListProperty="mylist">
      <arg0 key="${this:value}" resource="false"/>
      <arg1 key="${this:index}" resource="false"/>
      </field>
      So in the message would appear the value of the field email and the index of the
      element in collection.
      And more: for ValidWhen would be nice to have the value of the other field as
      well ("${fielddane:value}").
      I've put 'enhancement' but IMO it is the BASIC and trivial functionality which
      validator should implement.
      I said 'trivial' - it seemed to me. But after looking into the code of Struts
      and commons-validator I don't think any longer that it is trivial. Simply
      because not clean design of validator - example: commons-validator is treating
      the indexedListProperty (reading from the bean indexedProperty), but reading the
      value of the field is done in Struts (public static boolean validateMask(...)).
      So there is no clean way now to read value of the bean on common-validators
      level. And there is no clean way to read position/index in indexedProperty on
      Struts level. It is what I mean not clean design.
      I think validator needs real and smart refactoring before implementing this
      feature (together with nested indexedListProperty).
      (I recently moved from in-house C++ framework to JAVA-WEB-STRUTS and I found
      plenty of strange limitations of STRUTS modules, I hope that I will spare time
      at work to implement and give some patches)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                tomasz.bech@bull.com.pl Tomasz Bech
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated: