I want to handle non-business exception in the BPIMSExceptionHandlerServlet . So I make a BPIMSExceptionHandlerServlet class below.
And my web.xml file is:
Now I just create one NullPointerException in one Action class manually.
When I run the project, the BPIMSExceptionHandlerServlet catched the NullPointerException. But the problem is the program keep running. It seems a loop in doPost method. It just keeps running. I have debug the project. The program keep running from the first line to the last line in doPost method. Anybody know what's wrong here? Thanks in advance.
David Newton wrote:
In any case, the ability to redirect also depends on not having written anything to the response yet.
Yes, David is more precise than me :thumbup:
Thanks for your reply.
Now I correct the code.
but the program cannot find the error.html file. Give me a 404 error code. I also tried "error.html" or "/error.html". none of them work. Now I don't know what is the correct path in the sendRedirect() method. Do you know how to write in the method?
My project structure is:
BPIMS_Web --- WebContent --- WEB-INF --- jsp --- common --- error.html
- --- welcome.jsp
error.html and welcome.jsp are in the same directory.