I need to override the default conversion messages So, I m trying to make a custom conversion error interceptor for my application which would be called instead of struts default interceptor Below mentioned is the code for that
public class MyConversionErrorInterceptor extends ConversionErrorInterceptor {
private static final long serialVersionUID = 1L;
protected Object getOverrideExpr(ActionInvocation invocation, Object value) {
ValueStack stack = invocation.getStack();
return (String)stack.findValue("myproj.item");
}
protected boolean shouldAddError(String propertyName, Object value) {
return true;
}}
下面是提到的struts.xml配置。
<interceptors >
<interceptor name="conversionError" class="com.celtic.cmvs.webapp.interceptor.MyConversionErrorInterceptor" />
<interceptor-stack name="myDefaultStack">
<interceptor-ref name="conversionError" />
<interceptor-ref name="defaultStack"/>
</interceptor-stack>
But it doesn t work. Thanks in advance