<%@page import="java.sql.ResultSet"%><%@ page language="java" import="java.util.*,com.jinxin.dao.LoginMaker" contentType="text/html; charset=utf-8"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <base href="<%=basePath%>"> <title>My JSP 'book.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head><!-- <script type="text/javascript" src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script> <script type="text/javascript">window.onload=function(){ document.getElementById("prev_page").onclick=button1;}function button1(){ }</scirpt>--><style type="text/css">*{margin:0px;padding:0px}#content{width:auto; margin:0 200px;text-align:center;border:1px solid #000;background:#CCC}table{margin:0px auto 0 auto;border-top:2px solid #999;border-left:2px solid #999; }h3{padding-left:20px;border-bottom:#FFF solid 2px;margin-top:100px}td{border-bottom:2px solid #999;border-right:2px solid #999} </style> <body> <div id="content"> <h3>目录 </h3> <table> <tr class="title"> <td>Id</td> <td>Title</td> <td>Author</td> <td>UnitPrice</td> </tr> <% if(session.getAttribute("i")==null){ session.setAttribute("i",1); } int i=Integer.parseInt(""+session.getAttribute("i")); int j=8; for(int m=0;m<j;m++){ %> <tr> <td><%=LoginMaker.bookSelect(i*j-(j-1)+m).getInt(1) %> </td> <td><%=LoginMaker.bookSelect(i*j-(j-1)+m).getString(2) %> </td> <td><%=LoginMaker.bookSelect(i*j-(j-1)+m).getString(3) %> </td> <td><%=LoginMaker.bookSelect(i*j-(j-1)+m).getDouble(8) %> </td> <td><a href="book.jsp?id=<%=(i*j-(j-1)+m)%>">加入购物车</a> </td> </tr> <% } %> </table> <a href="prevPage.jsp" >上一页</a> <a href="nextPage.jsp" >下一页</a> </div> <div> <table> <% String temp_list=""; Cookie[] cookies=request.getCookies(); for(Cookie c:cookies){ if(c.getName().equals("idList")){ temp_list=c.getValue(); } } temp_list=temp_list+request.getParameter("id")+","; Cookie c =new Cookie("idList",temp_list); String[] list =temp_list.split(","); for(String s:list){ int m =Integer.parseInt(s);//108row,不知道哪里明明没问题啊 %> <tr> <td><%=LoginMaker.bookSelect(m).getInt(1) %> </td> <td><%=LoginMaker.bookSelect(m).getString(2) %> </td> <td><%=LoginMaker.bookSelect(m).getString(3) %> </td> <td><%=LoginMaker.bookSelect(m).getDouble(8) %> </td> </tr> <% } %> </table> </div> </body></html>错误内容:严重: Servlet.service() for servlet [jsp] in context with path [/WebPractice1] threw exception [An exception occurred processing JSP page /book.jsp at line 108105: Cookie c =new Cookie("idList",temp_list);106: String[] list =temp_list.split(",");107: for(String s:list){108: int m =Integer.parseInt(s);109: 110: %>111: <tr>Stacktrace:] with root causejava.lang.NumberFormatException: For input string: "null" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:492) at java.lang.Integer.parseInt(Integer.java:527) at org.apache.jsp.book_jsp._jspService(book_jsp.java:210) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1082) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:623) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:744)
添加回答
举报
0/150
提交
取消