首页 新闻 搜索 专区 学院

An exception occurred processing JSP page /business/look_buy/look_buy.jsp at line 42

0
悬赏园豆:10 [已解决问题] 解决于 2016-11-25 10:59
复制代码
org.apache.jasper.JasperException: An exception occurred processing JSP page /business/look_buy/look_buy.jsp at line 42

39:              tDAY1=zero_str.substring(0, 2-tDAY1.length())+tDAY1;
40:             String start_time=tYEAR+"-"+tMON+"-"+tDAY+" 00:00:00";
41:             String end_time=tYEAR1+"-"+tMON1+"-"+tDAY1+" 00:00:00";
42:             String user_name=session.getValue("user_name").toString();
45:             String table_name= "buyinfomation001";


Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:580)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause

java.lang.NullPointerException
    org.apache.jsp.business.look_005fbuy.look_005fbuy_jsp._jspService(look_005fbuy_jsp.java:133)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.72 logs.
复制代码

不知道怎么修改,谁知道的能不能告诉声, 42行怎么错了

问题补充:
look_buy.jsp
1
<%@page contentType="text/html"%> 2 <%@page pageEncoding="GB2312"%> 3 <%@page language="java"%> 4 <%@page import="java.io.*"%> 5 <%@page import="java.sql.*"%> 6 <%@page import="java.util.*"%> 7 <%@page import="java.util.Date"%> 8 9 <%//@page import="test1.*"%> 10 <%@page import="bean.*"%> 11 12 <%@page import="java.util.Iterator"%> 13 <%@page import="java.util.Map"%> 14 <%@page import="java.util.HashMap"%> 15 16 <html> 17 <body> 18 <% 23 String tYEAR = new String(request.getParameter("tYEAR").getBytes("ISO-8859-1")); 24 25 String tMON = new String(request.getParameter("tMON").getBytes("ISO-8859-1")); 26 27 String tDAY = new String(request.getParameter("tDAY").getBytes("ISO-8859-1")); 28 29 String tYEAR1 = new String(request.getParameter("tYEAR1").getBytes("ISO-8859-1")); 30 31 String tMON1 = new String(request.getParameter("tMON1").getBytes("ISO-8859-1")); 32 33 String tDAY1 = new String(request.getParameter("tDAY1").getBytes("ISO-8859-1")); 34 35 String zero_str ="00"; 36 tMON=zero_str.substring(0, 2-tMON.length())+tMON; 37 tDAY=zero_str.substring(0, 2-tDAY.length())+tDAY; 38 tMON1=zero_str.substring(0, 2-tMON1.length())+tMON1; 39 tDAY1=zero_str.substring(0, 2-tDAY1.length())+tDAY1; 40 String start_time=tYEAR+"-"+tMON+"-"+tDAY+" 00:00:00"; 41 String end_time=tYEAR1+"-"+tMON1+"-"+tDAY1+" 00:00:00"; 42 String user_name=session.getValue("user_name").toString(); 45 String table_name= "buyinfomation001"; 46 47 String sql="select id,user_name,company_name,product_name,buy_a_few,scan_number,text_information,code_type,commission,code_long,have_code,find_audit,buy_time,check_result,check_conclusion,remark from "+table_name+" where user_name='"+user_name+"' and find_audit='审完' and buy_time between '"+start_time+"' and '"+end_time+"' "; 48 TableBean tableBeans = null; 49 String id=""; 50 try 51 { 52 53 tableBeans = test_query_table.entrance(sql); 57 } 58 catch(Exception e) 59 { 60 e.printStackTrace(); 61 out.println("数据库操作失败"); 62 return; 63 } 64 65 %> 66 <table align="center" border="0" cellspacing="1"> 67 <tr> 68 <td><font size="3" color="blue">点击“选择”栏、删除响应记录</font></td> 69 </tr> 70 </table> 71 72 <table align="center" border="1" cellspacing="0"> 73 <font size="2" color="red"> 74 <tr> 75 <td width="100"> 76 <center> 77 <font size=2 color="black">序号</font> 78 </center> 79 </td> 80 <td width="300"> 81 <center> 82 <font size=2 color="black">用户名</font> 83 </center> 84 </td> 85 <td width="300"> 86 <center> 87 <font size=2 color="black">公司名称</font> 88 </center> 89 </td> 90 <td width="300"> 91 <center> 92 <font size=2 color="black">产品名称</font> 93 </center> 94 </td> 95 <td width="300"> 96 <center> 97 <font size=2 color="black">购买个数</font> 98 </center> 99 </td> 100 <td width="300"> 101 <center> 102 <font size=2 color="black">扫描次数</font> 103 </center> 104 </td> 105 <td width="300"> 106 <center> 107 <font size=2 color="black">文字信息</font> 108 </center> 109 </td> 110 <td width="300"> 111 <center> 112 <font size=2 color="black">码类别</font> 113 </center> 114 </td> 115 <td width="300"> 116 <center> 117 <font size=2 color="black">委托制作</font> 118 </center> 119 </td> 120 <td width="300"> 121 <center> 122 <font size=2 color="black">码边长</font> 123 </center> 124 </td> 125 <td width="300"> 126 <center> 127 <font size=2 color="black">带校验码</font> 128 </center> 129 </td> 130 <td width="300"> 131 <center> 132 <font size=2 color="black">是否已审</font> 133 </center> 134 </td> 135 <td width="300"> 136 <center> 137 <font size=2 color="black">购买时间</font> 138 </center> 139 </td> 140 <td width="300"> 141 <center> 142 <font size=2 color="black">审核结果</font> 143 </center> 144 </td> 145 <td width="300"> 146 <center> 147 <font size=2 color="black">审核结论</font> 148 </center> 149 </td> 150 <td width="300"> 151 <center> 152 <font size=2 color="black">备注</font> 153 </center> 154 </td> 155 </tr> 156 </font> 157 <% 158 RowBean[] rowBeans= tableBeans.getRowBean(); 159 int xh=0; 160 for(int j=0;j<rowBeans.length;j++){ 161 %> 162 <tr algin="left"> 163 164 165 <% 166 CellBean[] cellBeans= rowBeans[j].getCellBean(); 167 id=cellBeans[0].getValue(); 168 %> 169 <td width="100"><font size=2 color="black"><%=j+1%></font></td> 170 <% 171 for(int k=1;k<cellBeans.length;k++){ 172 %> 173 <td width="300"><font size=3 color="black">&nbsp;<%=cellBeans[k].getValue()%></font></td> 174 <% } 175 176 } 177 %> 178 </tr> 179 </table> 180 </body> 181 </html>

谁说不可以重名的主页 谁说不可以重名 | 初学一级 | 园豆:15
提问于:2016-11-25 09:24
< >
分享
最佳答案
0

你的 session 对象中没有 user_name 这個 key,于是 session.getValue("user_name") 得到的是空值(null),null 调用 toString() 方法时抛出 NullPointerException,要调用 42 行这句代码,你需要在这之前先调用 session.setValue("user_name", "xxx") 才行。

收获园豆:10
吸氧羊与肥汰狼 | 菜鸟二级 |园豆:280 | 2016-11-25 10:56

谢谢

谁说不可以重名 | 园豆:15 (初学一级) | 2016-11-25 10:59
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册