Struts 2
  1. Struts 2
  2. WW-2475

Provide a way to share validation.xml rules with ModelDriven

    Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 3.0
    • Component/s: None
    • Labels:
      None

      Description

      In Short:
      "ActionA" and "ActionB" both implement ModelDriven to expose an instance of "ModelClass" on the value stack.
      Some properties might be set on ModelClass. "ActionA" and "ActionB" have the same validation rules for properties of ModelClass.

      => It would be useful to share a set of validation rules in ModelClass-validation.xml.

      Does XWork allow validating other objects than actions ?

        Activity

        Hide
        Sami Dalouche added a comment -

        BTW, something that would make sense would be provide a mechanism to automatically add Model Driven's validation.xml file, to avoid boilerplate code.....

        if ModeDriven-validation.xml exists, then it makes sense to use it by default, and then provide a way to avoid using it....

        Show
        Sami Dalouche added a comment - BTW, something that would make sense would be provide a mechanism to automatically add Model Driven's validation.xml file, to avoid boilerplate code..... if ModeDriven-validation.xml exists, then it makes sense to use it by default, and then provide a way to avoid using it....
        Hide
        Sami Dalouche added a comment -

        Dave, I think you're right, this seems to do what I need.

        Then, I guess we can transform this feature request into a documentation request... Maybe just a link to the visitor validator (http://struts.apache.org/2.x/docs/visitor-validator.html ) in the "Model Driven" section of the guides (http://struts.apache.org/2.x/docs/guides.html).

        Show
        Sami Dalouche added a comment - Dave, I think you're right, this seems to do what I need. Then, I guess we can transform this feature request into a documentation request... Maybe just a link to the visitor validator ( http://struts.apache.org/2.x/docs/visitor-validator.html ) in the "Model Driven" section of the guides ( http://struts.apache.org/2.x/docs/guides.html ).
        Hide
        Dave Newton added a comment -

        Doesn't this already exist?

        I thought you could do model-based validation and, in addition, refer to model-based validation via the visitor field validation.

        Show
        Dave Newton added a comment - Doesn't this already exist? I thought you could do model-based validation and, in addition, refer to model-based validation via the visitor field validation.

          People

          • Assignee:
            Unassigned
            Reporter:
            Sami Dalouche
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development