开发者

OGNL exceptions setting Struts2 checkbox value

开发者 https://www.devze.com 2023-03-19 15:16 出处:网络
After adding a s:checkbox to my form, I get OGNL errors in the ParamsIntercept开发者_Go百科or: WARN[OgnlValueStack] Error setting expression \'__checkbox_filter.findRejected\' with value \'[Ljava.lan

After adding a s:checkbox to my form, I get OGNL errors in the ParamsIntercept开发者_Go百科or:

WARN  [OgnlValueStack] Error setting expression '__checkbox_filter.findRejected' with value '[Ljava.lang.String;@dc926f'
ognl.OgnlException: target is null for setProperty(null, "findRejected", [Ljava.lang.String;@dc926f)

I am aware that the extra hidden field with underscores in its name (__checkbox_filter.findRejected) was correctly added by Struts2.

I don't understand, however, why the ParametersInterceptor is trying to set this property, that was added by Struts2, on my Action (which obviously doesn't contain a '__checkbox_filter' property).

It is normal to see this OGNL error coming from with Struts2 checkboxes? How can I avoid it?


I've just stumble across the very same problem.

You need to place the Checkbox Interceptor BEFORE the Parameters Interceptor in your interceptor stack.

This is the case by default, so I guess that you're using a custom stack...


Most of the time the mistake in such cases is that we forget to write getters and setters for the attributes. So check whether the getters and setters are at their place.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号