I have got problems with sending this JSP page. Errors in a stack should be pass to
the subject. Included file month.jsp runs very well. I put to it error, for example
wrong year format, and I expect that exception will be send in a subject and errors
in a body to the user2. Instead of that I get error as below jsp page. This page
whitout passing the exception trace and the query string works very well, but the idea
is passing eventually errors. Tell me please, what is the reason.
Andrzej Michalczyk.
Thank You.
<%@ page isErrorPage="true" %>
<html>
<head>
<title>Oops!</title>
</head>
<body>
<h1>We are sorry</h1>
The page you have just reached has some errors.
Our technical staff have been informed of the error and will fix it as soon as
possible.
<p>
<%@ include file ="month.jsp" %>
<% // Create the body passing the exception trace and the query string
String body = null;
java.io.StringWriter sw = new java.io.StringWriter();
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
exception.printStackTrace(pw);
body = sw.toString() + request.getQueryString();
%>
<jsp:include page="sendmail.jsp" flush="true">
<jsp:param name="fromName" value="user1" flush="true" />
<jsp:param name="fromAddr" value="[EMAIL PROTECTED]" />
<jsp:param name="toName" value="user2"/>
<jsp:param name="toAddr" value="[EMAIL PROTECTED]"/>
<jsp:param name="subject" value="<%= exception %>"/>
<jsp:param name="body" value="<%= body %>"/>
</jsp:include>
%>
<p>
Thank you for your patience
</body>
</html>
Error: 500
Location: /jsp/error/error1.jsp
Internal Servlet Error:
javax.servlet.ServletException
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:386)
at
jsp.error._0002fjsp_0002ferror_0002ferror_00031_0002ejsperror1_jsp_3._jspService(_0002fjsp_0002ferror_0002ferror_00031_0002ejsperror1_jsp_3.java:218)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:174)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
at java.lang.Thread.run(Unknown Source)
Root cause:
java.lang.NullPointerException
at
jsp.error._0002fjsp_0002ferror_0002ferror_00031_0002ejsperror1_jsp_3._jspService(_0002fjsp_0002ferror_0002ferror_00031_0002ejsperror1_jsp_3.java:186)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:174)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
at java.lang.Thread.run(Unknown Source)