struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J Alex (JIRA)" <j...@apache.org>
Subject [jira] Created: (STR-3049) Specifying Dispatcher based validations in validation.xml
Date Thu, 07 Jun 2007 13:15:26 GMT
Specifying Dispatcher based validations in validation.xml
---------------------------------------------------------

                 Key: STR-3049
                 URL: https://issues.apache.org/struts/browse/STR-3049
             Project: Struts 1
          Issue Type: Improvement
          Components: Core
         Environment: N/A
            Reporter: J Alex


I want to confirm if there's a way to specify a mapping between the dispatch methods and the
validations declaratively.

The method should be independent of javascript.

Scenario : 

Consider a single-page form (i.e  single  HTML <form> mapping to say /myAction.do )
with many sections, each section having its own Submit button. On submit of each, ONLY the
fields within that section must be validated.

Using DispatchAction to handle each submit button takes care of centralizing the handler methods
and making the Action classes crisp. But, when it comes to validation, there's no way to specify
in validation.xml the fields tied to a specific dispatch method.

We could use the "page" parameter to delimit the validations, but this cannot be done declaratively
since we cannot dynamically change the "page" using javascript on a particular submit. The
workaround is to set validate=false, and explicitly invoke validation from the Action class
after setting the "page" within each dispatcher method.

i.e 
myForm.setPage(1);

I think it will be a good enhancement to provide this mapping within Struts itself which i
feel will greatly enhance the utility of DispatchAction.


ActionMessages errors = myForm.validate( mapping, request );

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message