Struts2中的ognl.OgnlException问题
二猪戏龙 2008-05-05 01:48:41 利用struts2做了一个简单的注册例子,在JSP页面上有用户名username和年龄age两项,分别对应action中的String username和int age;变量。我在不输入任何信息提交时,后台会报错:但jsp页面正常提示校验信息。请高手帮忙,错误如下(不全):
ognl.OgnlException: age [java.lang.NullPointerException]
at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:83)
at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:131)
at com.opensymphony.xwork2.util.OgnlValueStack$ObjectAccessor.setProperty(OgnlValueStack.java:68)
at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
at com.opensymphony.xwork2.util.CompoundRootAccessor.setProperty(CompoundRootAccessor.java:44)
at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
at ognl.SimpleNode.setValue(SimpleNode.java:246)
at ognl.Ognl.setValue(Ognl.java:476)
at com.opensymphony.xwork2.util.OgnlUtil.setValue(OgnlUtil.java:186)
at com.opensymphony.xwork2.util.OgnlValueStack.setValue(OgnlValueStack.java:158)
at com.opensymphony.xwork2.util.OgnlValueStack.setValue(OgnlValueStack.java:146)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(