Javax.servlet.error.status_code
and Type Constant Field Value publicstaticfinaljava.lang.String ASYNC_CONTEXT_PATH "javax.servlet.async.context_path" publicstaticfinaljava.lang.String ASYNC_PATH_INFO "javax.servlet.async.path_info" publicstaticfinaljava.lang.String ASYNC_QUERY_STRING "javax.servlet.async.query_string" publicstaticfinaljava.lang.String ASYNC_REQUEST_URI "javax.servlet.async.request_uri" publicstaticfinaljava.lang.String ASYNC_SERVLET_PATH "javax.servlet.async.servlet_path" javax.servlet.RequestDispatcher Modifier and Type Constant Field Value publicstaticfinaljava.lang.String ERROR_EXCEPTION "javax.servlet.error.exception" publicstaticfinaljava.lang.String ERROR_EXCEPTION_TYPE "javax.servlet.error.exception_type" publicstaticfinaljava.lang.String ERROR_MESSAGE "javax.servlet.error.message" publicstaticfinaljava.lang.String ERROR_REQUEST_URI "javax.servlet.error.request_uri" publicstaticfinaljava.lang.String ERROR_SERVLET_NAME "javax.servlet.error.servlet_name" publicstaticfinaljava.lang.String ERROR_STATUS_CODE "javax.servlet.error.status_code" publicstaticfinaljava.lang.String FORWARD_CONTEXT_PATH "javax.servlet.forward.context_path" publicstaticfinaljava.lang.String FORWARD_PATH_INFO "javax.servlet.forward.path_info" publicstaticfinaljava.lang.String FORWARD_QUERY_STRING "javax.servlet.forward.query_string" publicstaticfinaljava.lang.String FORWARD_REQUEST_URI "javax.servlet.forward.request_uri" publicstaticfinaljava.lang.String FORWARD_SERVLET_PATH
javax.transaction.* javax.ws.* javax.xml.* javax.ejb.* javax.ejb.embeddable.EJBContainer 1 0 9 8 7 6 5 4 3 javax.el.* javax.el.ELResolver 2 1 0 9 8 7 javax.faces.* javax.faces.FactoryFinder 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 javax.faces.application.FacesMessage 3 2 1 javax.faces.application.ProjectStage 0 9 8 7 6 5 javax.faces.application.Resource 4 3 2 javax.faces.application.ResourceHandler 1 0 9 https://tomcat.apache.org/tomcat-7.0-doc/servletapi/constant-values.html 8 7 6 5 4 3 2 1 0 javax.faces.application.StateManager 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 javax.faces.application.ViewHandler 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 javax.faces.component.NamingContainer 0 9 http://docs.oracle.com/javaee/6/api/constant-values.html 8 javax.faces.component.UIColumn 7 6 5 4 3 2 javax.faces.component.UICommand 1 0 9 8 7 6 javax.faces.component.UIComponent 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 javax.faces.component.UIData 8 7 6 5 4 3 javax.faces.component.UIForm 2 1 0 9 8 7 javax.faces.component.UIGraphic 6 5 4 3 2 1 javax.faces.component.UIInput 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 javax.faces.component.UIMessage 2 1 0 9 8 7 javax.faces.component.UIMessages 6 5 4 3 2 1 javax.faces.component.UINamingContainer 0 9 8 7 6 5 4 3 2 javax.faces.component.UIOutcomeTarget 1 0 9 8 7 6 javax.faces.component.UIOutput 5 4 3 2 1 0 javax.faces.component.UIPanel 9 8 7 6 5 4 javax.faces.component.UIParameter 3 2 1 0 9 8 javax.faces.component.UISelectBoolean 7 6 5 4 3 2
QuestionsJava Interview QuestionsJDBC Interview QuestionsServlet Interview QuestionsJSP Interview QuestionsStruts2 Interview QuestionsSpring Interview QuestionsHibernate Interview QuestionsJSF Interview QuestionsResourcesStoreHome » http://www.journaldev.com/1973/servlet-exception-and-error-handling-example-tutorial Java » Java EE » Servlet Exception and http://stackoverflow.com/questions/995248/how-to-get-the-message-in-a-custom-error-page-tomcat Error Handling Example TutorialServlet Exception and Error Handling Example TutorialJuly 14, 2016 by Pankaj 13 Comments Today we will look into Servlet Exception and Error Handling. Sometime back I wrote a post about Exception Handling in Java but when it comes to web application, we need more than normal exception handling in java.Servlet ExceptionIf you notice, doGet() and doPost() methods throw javax.servlet.ServletException and IOException, let's see what happens when we throw these exception from our application. I will write a simple servlet that will throw the ServletException. package com.journaldev.servlet.exception; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/MyExceptionServlet") public class MyExceptionServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { throw new ServletException("GET method is not supported."); } } Now when we invoke this servlet through browser with GET method, we get response like below image.Since browser understand only HTML, when our application throw exception, servlet container processes the exception and generate a HTML response. This logic is specific to servlet container. I am using tomcat and getting this error page. If you will use some other ser
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up How to get the message in a custom error page (Tomcat)? up vote 23 down vote favorite 7 In JSPs, you may use response.sendError(int code, String message) to return a particular error code (eg 404 for not found) and a message as well. These messages display fine, as long as you use the default ugly Tomcat error pages. However, if you create a custom error page, how do you get that message? I've tried exception.getMessage() or pageContext.getErrorData() but no avail. I've been searching for this for like hours and nobody seems to even wonder about the same thing! :S I forgot to mention I've only tried it with 404s so far, since that's what I need most... The exception is null for some reason, so trying anything on it throws a NullPointerException. The error page is a 404 error page, set via web.xml (since I want it to be displayed for EVERY single 404 error) and for anyone wondering, yes it has the isErrorPage directive set to true... jsp tomcat custom-error-pages share|improve this question edited Jun 15 '09 at 14:51 asked Jun 15 '09 at 9:46 Lea Verou 13.8k63142 Does your custom 404 page never work? How do you check if it works? Have you check if the below by me mentioned request attributes exist? Last resort try this tutorial playground.greyscale.se/wiki/en/Custom_404_page_in_Tomcat –jitter Jun 15 '09 at 15:48 No it works fine. I jus