报错信息
2017-11-18 14:46:11,552 [http-nio-8080-exec-8] ERROR org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler - Exception occurred during processing request: null
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:542)
at java.lang.Integer.valueOf(Integer.java:766)
at cn.sx.action.PaymentAction.paymentadd(PaymentAction.java:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:870)
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1293)
at ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68)
at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:117)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:564)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
at java.lang.Thread.run(Thread.java:745)action类:
public class PaymentAction extends ActionSupport{
private PaymentService paymentService;
public void setPaymentService(PaymentService paymentService) {
this.paymentService = paymentService;
}
private HttpServletRequest request = ServletActionContext.getRequest(); /**
* 缴费信息添加
*/
public String paymentadd(){
String proid = request.getParameter("property");
String type = request.getParameter("type");
String paycycle = request.getParameter("paycycle");
String cost = request.getParameter("cost");
String re = request.getParameter("re");
Property pro = paymentService.findprobean(Integer.valueOf(proid));
Payment pay = new Payment();
pay.setProperty(pro);
pay.setType(type);
pay.setPaycycle(paycycle);
pay.setCost(cost);
pay.setRe(re);
pay.setPaymentlock(0);
pay.setCreatetime(new Date());
pay.setPaytime(new Date());
paymentService.insertpayment(pay);
return "repaymentlist";
}
service类:
@Transactional
public class PaymentService {
private PaymentDao paymentDao; public void setPaymentDao(PaymentDao paymentDao) {
this.paymentDao = paymentDao;
}
public Property findprobean(Integer proid) {
return paymentDao.findprobean(proid);
}
dao类:
public interface PaymentDao { Property findprobean(Integer proid);}dao实现类:
public class PaymentDaoImpl extends HibernateDaoSupport implements PaymentDao {
public void insertpayment(Payment pay) {
this.getHibernateTemplate().save(pay);
} public Property findprobean(Integer proid) {
List<Property> list = (List<Property>) this.getHibernateTemplate().find("from Property where proid = ?", proid);
if (list!=null && list.size()!=0) {
return list.get(0);
}
return null;
}spring:
<bean id="paymentAction" class="cn.sx.action.PaymentAction" scope="prototype">
<property name="paymentService" ref="paymentService"></property>
</bean> <bean id="paymentService" class="cn.sx.service.PaymentService" scope="prototype">
<property name="paymentDao" ref="paymentDaoImpl"></property>
</bean> <bean id="paymentDaoImpl" class="cn.sx.dao.PaymentDaoImpl" scope="prototype">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
我用断点找了,结果是显示
求助大神!!
2017-11-18 14:46:11,552 [http-nio-8080-exec-8] ERROR org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler - Exception occurred during processing request: null
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:542)
at java.lang.Integer.valueOf(Integer.java:766)
at cn.sx.action.PaymentAction.paymentadd(PaymentAction.java:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:870)
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1293)
at ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68)
at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:117)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:564)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
at java.lang.Thread.run(Thread.java:745)action类:
public class PaymentAction extends ActionSupport{
private PaymentService paymentService;
public void setPaymentService(PaymentService paymentService) {
this.paymentService = paymentService;
}
private HttpServletRequest request = ServletActionContext.getRequest(); /**
* 缴费信息添加
*/
public String paymentadd(){
String proid = request.getParameter("property");
String type = request.getParameter("type");
String paycycle = request.getParameter("paycycle");
String cost = request.getParameter("cost");
String re = request.getParameter("re");
Property pro = paymentService.findprobean(Integer.valueOf(proid));
Payment pay = new Payment();
pay.setProperty(pro);
pay.setType(type);
pay.setPaycycle(paycycle);
pay.setCost(cost);
pay.setRe(re);
pay.setPaymentlock(0);
pay.setCreatetime(new Date());
pay.setPaytime(new Date());
paymentService.insertpayment(pay);
return "repaymentlist";
}
service类:
@Transactional
public class PaymentService {
private PaymentDao paymentDao; public void setPaymentDao(PaymentDao paymentDao) {
this.paymentDao = paymentDao;
}
public Property findprobean(Integer proid) {
return paymentDao.findprobean(proid);
}
dao类:
public interface PaymentDao { Property findprobean(Integer proid);}dao实现类:
public class PaymentDaoImpl extends HibernateDaoSupport implements PaymentDao {
public void insertpayment(Payment pay) {
this.getHibernateTemplate().save(pay);
} public Property findprobean(Integer proid) {
List<Property> list = (List<Property>) this.getHibernateTemplate().find("from Property where proid = ?", proid);
if (list!=null && list.size()!=0) {
return list.get(0);
}
return null;
}spring:
<bean id="paymentAction" class="cn.sx.action.PaymentAction" scope="prototype">
<property name="paymentService" ref="paymentService"></property>
</bean> <bean id="paymentService" class="cn.sx.service.PaymentService" scope="prototype">
<property name="paymentDao" ref="paymentDaoImpl"></property>
</bean> <bean id="paymentDaoImpl" class="cn.sx.dao.PaymentDaoImpl" scope="prototype">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
我用断点找了,结果是显示
求助大神!!
解决方案 »
- 关于JS与JSP的传值问题
- mysql+hql+limit问题
- 读取spring配置文件时,为何总报转换异常,请各位牛人帮忙
- javaMail出错Access to default session denied
- session问题?急
- 紧急求助:为什么我新开页面中getparameter得到的均为乱码,无论如何转换,都没用。
- Hibernate配置映射文件问题
- 急,在jsp和servlet中如何判断网络连接超时?
- 关于制作java安装程序
- 我这个图像是apple自绘的,然后用GIFEncoder转为gif文件格式,想传给servlet,该怎么做?
- 访问时出现了错误,跳出了这段代码怎么回事。在别的电脑能够跳转!!!谢谢大佬们
- jsp引入js css问题
at java.lang.Integer.parseInt(Integer.java:542)
at java.lang.Integer.valueOf(Integer.java:766)
at cn.sx.action.PaymentAction.paymentadd(PaymentAction.java:86)
PaymentAction的86行,打印proid是否为null???
at java.lang.Integer.parseInt(Integer.java:542)
at java.lang.Integer.valueOf(Integer.java:766)
at cn.sx.action.PaymentAction.paymentadd(PaymentAction.java:86) 这里报错信息比较明显了,PaymentAction这个类的86行,前面报转化失败,那应该传了个错误的类型或者null过来了
if (list!=null && list.size()!=0) {
return list.get(0);
}
return null;看看你这个list是不是为null 如果为null 那么你返回的就是null 当然最后null不能转为数字就会报哪个错啊
at java.lang.Integer.parseInt(Integer.java:542)这该是参数问题吧
这行代码是啥