为了账号安全,请及时绑定邮箱和手机立即绑定

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

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 回答

String name = fileBean.getFileName();
if (name == null){//加上这句就OK了,具体原因,可以查看API
    name = "";
}
boolean boo = name.endsWith(".jpg");
boo = boo || name.endsWith(".gif");


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

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

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信