struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Laurent Mimoun (JIRA)" <>
Subject [jira] Created: (WW-3180) Add the capabilities to activate validation only in some cases
Date Thu, 09 Jul 2009 14:44:59 GMT
Add the capabilities to activate validation only in some cases

                 Key: WW-3180
             Project: Struts 2
          Issue Type: New Feature
          Components: "New" API, Core Actions, Core Interceptors, XML Validators
    Affects Versions: 2.1.7
            Reporter: Laurent Mimoun


In our pages, 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 (if the action method id actionMethod,
the validationFilterInterceptor will call actionMethodValidationFilter).


We propose:
1. to add a new Annotation @ValidationCase(name="validationCase1") that applies on the action
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 is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message