Struts怎么捕获NumberFormatException

大家好,我试了两天
 Struts2.18  myEclipse8.0

我自定义了一个类型转换器[code="java"]

public Object convertFromString(Map arg0, String[] arg1, Class arg2) {
Integer inte=null;
for(int i=0;i<arg1.length;i++)
{
String [] tempStr = arg1[i].split("-");
StringBuilder sb = new StringBuilder();
for(int j=0;j< tempStr.length;j++)
sb.append(tempStr[j]);

        inte =new Integer(sb.toString());


    }

    return inte;}

[/code]
当我传入正确的参数时 他能正常的工作 但是当我输入字母时 如aaa 时.后台就会打印一大条的错误
ognl.MethodFailedException: Method "setId" failed for object com.wugang.User@1e9c82e [java.lang.NoSuchMethodException: com.wugang.User.setId([Ljava.lang.String;)]
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1265)
at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1454)
at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:85)
at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162)
at com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:28)
at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2225)
at ognl.ASTProperty.setValueBody(ASTProperty.java:127)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
at ognl.SimpleNode.setValue(SimpleNode.java:301).....
java.lang.NoSuchMethodException: com.wugang.User.setId([Ljava.lang.String;)
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1206)
at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1454)
at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:85)
at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162)
at com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:28)
at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2225)
at ognl.ASTProperty.setValueBody(ASTProperty.java:127)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
at ognl.SimpleNode.setValue(SimpleNode.java:301)
at ognl.ASTChain.setValueBody(ASTChain.java:227)

当然 我应用了conversionError 拦截器 而且filederrors 字段里有错误的信息 但为什么后台还有错误呢 不是被拦截器捕获了后台就应该没有错了么 还是我自己理解错了 求大家帮帮我

[color=blue][b]捕获异常,然后抛出[/b][/color]
[code="java"]try{
inte =new Integer(sb.toString());

}catch(NumberFormatException numb){
throw new com.opensymphony.xwork2.conversion.TypeConversionException("Failed")
}[/code]

[quote]java.lang.NoSuchMethodException: com.wugang.User.setId([Ljava.lang.String;)] [/quote]
从异常的信息来,看在User中没有setId这个方法。

[quote]当然 我应用了conversionError 拦截器 而且filederrors 字段里有错误的信息 但为什么后台还有错误呢 不是被拦截器捕获了后台就应该没有错了么 还是我自己理解错了 求大家帮帮我 [/quote]
这些拦截都属于后台。

这处理比较好:
[code="java"]try{
inte =new Integer(sb.toString());

}catch(NumberFormatException numb){
// 这里处理错误。
}[/code]

PS:你的拦截器栈如何设置的?贴出来看看?

[quote] 我的拦截器是这样配的



[/quote]

你的Exception拦截器在哪?