I am using Jboss server, i want to know does it recognize all the HTTP Client Error Code(4XX) and HTTP Server Error Code(5XX) so that i can configure my custom error page like for 502, 503 etc. in web.xml? Thanks in advance.
Edit : i did't find any documentation that has defined this. but @Jeremy suggested me a way to test it out: Write a Servlet to return error code you want as following.
response.sendError([Error code goes here],
"Error Message");
I think you are looking for this:
<error-page>
<error-code>404</error-code>
<location>/ErrorPage.jsp</location>
</error-page>
To test this, write a servlet that specifically returns the error code.
There are few approaches to set custom error pages.
If you are using JSP's in presentation layer.
foo.jsp
<%@ page errorPage="/errorPage.jsp" %> // Here we are redirecting to error.jsp if any exception is thrown
errorPage.jsp
<%@ page isErrorPage="true" %>
I suggest this for development purposes.
At Application Level
Setting errorpages in web.xml
like above answer
<error-page> <error-code>404</error-code> <location>/ErrorPage.jsp</location> </error-page>
I still need to experiment with Container level, by editing web.xml found in jboss-web.sar or jboss-tomcatxx.sar
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.