[
https://issues.apache.org/jira/browse/WW-3180?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Lukasz Lenart closed WW-3180.
-----------------------------
Resolution: Won't Fix
> Add the capabilities to activate validation only in some cases
> --------------------------------------------------------------
>
> Key: WW-3180
> URL: https://issues.apache.org/jira/browse/WW-3180
> Project: Struts 2
> Issue Type: New Feature
> Components: "New" API, Core Actions, Core Interceptors,
> XML Validators
> Affects Versions: 2.1.8
> Reporter: Laurent Mimoun
> Priority: Major
> Fix For: 6.1.0
>
>
> Problem
> In our application, we have one form for the entire page because the user
> must decide (after a javascript confirmation) to save the data modified in
> all the block of the page. But in some case and if the user decide not saving
> all the modified page fields, we must only validate fields, the user want to
> save.
> STRUTS ParameterInterceptor and ValidationInterceptor interceptors don't
> offer a good solution for this problem : the only solution is to migrate the
> validation annotations to declare validation rules in an XML file (but there
> will be a lot of code duplication in this case) or coding rules by hand in a
> validate method.
> In our application, we found this trick but this is not elegant : we added a
> new interceptor ValidationFilterInterceptor that calls a method dynamically
> actionMethodValidationFilter (if the action method id actionMethod, the
> validationFilterInterceptor will call actionMethodValidationFilter) where we
> remove the "bad" errors (something like this :
> setFieldErrors(filterFieldErrorsOn("data2", getFieldErrors())));
> Proposal
> 1. to add a new Annotation @ValidationCase(name="case1") that applies on the
> action method
> 2. to add a new parameter validationCase in all Validation annotation ex :
> @RequiredValidator(key = "validation.required", validationCase={"case1"})
> 3. to take into account in ParameterInterceptor and ValidationInterceptor,
> this annotation and new parameter in existing annotations to add
> conversion/validation rules only for the annotation linked to the "current"
> validation case.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)