求教
ClassCastException错误?
javax.servlet.ServletException: java.lang.Integer
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:535) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:433)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
java.lang.ClassCastException: java.lang.Integer com.yourcompany.struts.action.VehicleinfoAction.check_out(VehicleinfoAction.java:328)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
我添加数据的时候总报上面的错误是怎么回事?怎样解决呀?
这是我的源代码:
String cardid=vehicleinfoForm.getCardid();
String endtime=request.getParameter("endtime");
String starttime=request.getParameter("starttime");
HttpSession session=request.getSession();
String mon=(String) session.getAttribute("money");
float money=Float.valueOf(mon).floatValue();
VehicleDAO dao=new VehicleDAO();
int r=dao.add_rate(cardid, endtime, starttime, money);
if(r>0)
{
request.setAttribute("ms", "结算成功!");
return mapping.findForward("information");
}else
{
request.setAttribute("ms", "系统出现异常!");
return mapping.findForward("information");
}
------解决方案--------------------
VehicleinfoAction.java:328这行类型转换出问题了
------解决方案--------------------
你哪一行报错,
或者这么说VehicleinfoAction.java:328行是你贴出来的代码中的哪句,
你只要看看那句代码是把什么类型转成什么类型就知道什么错了