struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kibo <tomasjur...@gmail.com>
Subject Re: Validate associate Map
Date Sat, 16 Aug 2008 19:31:26 GMT

Hi Dave

Thanks a lot for your help.  I found out that the VisitorFieldValidator can
work with Object, Arrays and Collections.

Then I convert the Map to Collection and it begins work correct.

@Validations( visitorFields = {
        @VisitorFieldValidator(
                message = "Default message", key = "i18n.key",
                fieldName= "page.texts.values", appendPrefix = false) }
    )
    public String save() throws Exception{
        LOG.debug("ManagerPagesAction - method:save");                        
        pageService.update(page);
        return execute();
    }
   ...
----------------------
 &lt;interceptor-ref name="validation"&gt;
        &lt;param name="validateAnnotatedMethodOnly"&gt;true&lt;/param&gt;
                
 &lt;/interceptor-ref&gt;


Thanks



newton.dave wrote:
> 
> --- On Sat, 8/16/08, Kibo wrote:
>> I have to write custom validation method where I iterate all
>> "PageText" class and validate it. I want to use validate() 
>> method from ActionSupport class but the method is invoke always.
>> I need invoke validator method only when is invoke method
>> save(); Is better resolution?
> 
> One option would be to read the documentation for the validation
> interceptor [1,2] and its superclass, MethodFilterInterceptor [3].
> 
> Dave
> 
> [1] Validation interceptor overview:
> http://struts.apache.org/2.x/docs/validation-interceptor.html
> 
> [2] ValidationInterceptor Javadocs:
> http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/validator/ValidationInterceptor.html
> 
> [3] MethodFilterInterceptor Javadocs:
> http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/interceptor/MethodFilterInterceptor.html
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 


-----
Tomas Jurman
Czech Republic
-- 
View this message in context: http://www.nabble.com/Validate-associate-Map-tp19010237p19014275.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message