以下は私の.jspの一部です。JSP - HTTPステータス500 - 内部サーバーエラー
<%User user = (User) (session.getAttribute("user"));%>
<b>Welcome <%= user.getFirstName() + " " + user.getLastName()%></b>
<br/>
そして、私はエラーの下に取得しています:
HTTP Status 500 – Internal Server Error
Type Exception Report
Message An exception occurred processing [/home.jsp] at line [20]
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception org.apache.jasper.JasperException: An exception occurred processing [/home.jsp] at line [20]
17: This is added information page
18: <%=new Date()%> 19: <%User user = (User) (session.getAttribute("user"));%> 20: Welcome <%= user.getFirstName() + " " + user.getLastName()%> 21:
22: 23: LogoutStacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:593) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:482) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329) javax.servlet.http.HttpServlet.service(HttpServlet.java:741) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Root Cause java.lang.NullPointerException org.apache.jsp.home_jsp._jspService(home_jsp.java:139) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:741) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:444) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329) javax.servlet.http.HttpServlet.service(HttpServlet.java:741) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Note The full stack trace of the root cause is available in the server logs.
Apache Tomcat/9.0.1
誰かがplsは助けることはできますか?エラーは行20にあります。user
(= session.getAttribute("user")
)がnullであるため、
[NullPointerExceptionとは何か、それを修正するにはどうすればいいですか?](https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix -それ) –