[ 
https://issues.apache.org/struts/browse/STR-3049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_41185
 ] 

Niall Pemberton commented on STR-3049:
--------------------------------------

Yes you're right there is no way to specify a mapping between the dispatch 
methods and the validations declaratively.

The problem is that we have various flavours of Disptach action (vanilla, 
lookup, mapping, event) and they use various mechanisms to the determine the 
dispatch method - the logic of which is all locked in each of the 
DispatchAction implementations. So the trick is going to be coming up with a 
mechanism which supports each of those flavours. So someone needs to come up 
with a good solution for this issue to have any chance - otherwise we should 
close as WONT FIX. 


> 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.

Reply via email to