这个怎么回事呀,错在哪里了,帮帮忙

来源:-

秀log

2016-04-28 10:26

type Exception report

message An exception occurred processing JSP page /example8_6.jsp at line 25

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: An exception occurred processing JSP page /example8_6.jsp at line 25

22:  
23: <%
24: String name=fileBean.getFileName();
25: boolean boo=name.endsWith(".jpg");
26: boo=boo||name.endsWith(".gif");
27: if(boo){
28: %>  <image src="image/<%=name  %>" width=200 height=200><%=name %></image>


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:574)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

root cause

java.lang.NullPointerException
org.apache.jsp.example8_005f6_jsp._jspService(example8_005f6_jsp.java:142)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
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/8.0.32 logs.


写回答 关注

1回答

  • qq_碾作尘_1
    2018-08-04 20:58:57
    String name = fileBean.getFileName();
    if (name == null){//加上这句就OK了,具体原因,可以查看API
        name = "";
    }
    boolean boo = name.endsWith(".jpg");
    boo = boo || name.endsWith(".gif");


JAVA遇见HTML——JSP篇

Java Web入门级教程JSP,带你轻松的学习JSP基础知识

248278 学习 · 3071 问题

查看课程

相似问题