dcsimg
How to specify multiple acceptParamNames in Struts2 using annotations (convention plugin)?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Tiny
Posted On:   Wednesday, December 25, 2013 03:07 PM

I'm trying to set multiple acceptable parameters through the  params  interceptor like as follows. @Namespace("/admin_side")     @ResultPath("/WEB-INF/content")     @InterceptorRefs({         @InterceptorRef(value="defaultStack",              params={"params.excludeParams", "^action:(?!postAction$)\\w*$",             "params.acceptParamNames", "action:postAction",             "params.acceptParamNames", "id",    More>>
I'm trying to set multiple acceptable parameters through the  params  interceptor like as follows.
@Namespace("/admin_side")
    @ResultPath("/WEB-INF/content")
    @InterceptorRefs({
        @InterceptorRef(value="defaultStack", 
            params={"params.excludeParams", "^action:(?!postAction$)\\w*$",
            "params.acceptParamNames", "action:postAction",
            "params.acceptParamNames", "id",
            "params.acceptParamNames", "name",
            "params.acceptParamNames", "email",
            "params.acceptParamNames", "number",
            "params.acceptParamNames", "deleteOneRow",        
            "validation.excludeMethods", "test"}),            
    })
    public final class TestAction extends ActionSupport implements Serializable, ValidationAware, ModelDriven<Transporter>
    {
        //...
    }

In this case, only the last parameter which is `deleteOneRow` (`Boolean`) is accepted. The rest are not accepted. Instead, it issues warnings as follows.

    Dec 26, 2013 4:00:04 AM com.opensymphony.xwork2.interceptor.ParametersInterceptor warn
    WARNING: Parameter [action:postAction] didn't match acceptParams list of patterns!
    Dec 26, 2013 4:00:04 AM com.opensymphony.xwork2.interceptor.ParametersInterceptor warn
    WARNING: Parameter [id] didn't match acceptParams list of patterns!
    Dec 26, 2013 4:00:04 AM com.opensymphony.xwork2.interceptor.ParametersInterceptor warn
    WARNING: Parameter [email] didn't match acceptParams list of patterns!
    Dec 26, 2013 4:00:04 AM com.opensymphony.xwork2.interceptor.ParametersInterceptor warn
    WARNING: Parameter [name] didn't match acceptParams list of patterns!
    Dec 26, 2013 4:00:04 AM com.opensymphony.xwork2.interceptor.ParametersInterceptor warn
    WARNING: Parameter [number] didn't match acceptParams list of patterns!

How to set multiple parameters to `params.acceptParamNames` using convention plugin?

 
   <<Less
About | Sitemap | Contact