| Author |
Configurting all errors to single page
|
vipul bondugula
Ranch Hand
Joined: Oct 14, 2010
Posts: 218
|
|
Hi All,
In web.xml i have configured 404 and 500 errors to single page./error.jsp.code looks like
<error-page>
<error-code>404</error-code>
<location>/pageNotFound.jsp</location>
</error-page>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/pageNotFound.jsp</location>
</error-page>
How to identify error codes in error.jsp and customize my messages...
Thanks in Advance...
|
Thanks
Vipul Kumar
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56528
|
|
If you are going to perform any processing on the error, you should be sending the error to a servlet, not a JSP.
All of the error information is available as scoped variables placed in the request. The Servlet Specification has all the details on the names of these variable.
Once you are ready to present information to the user, the servlet can forward to a JSP to present the view.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
vipul bondugula
Ranch Hand
Joined: Oct 14, 2010
Posts: 218
|
|
Thanks for your reply
I have read the servlet specification.I tried the 5 variables in my JSP page.only request.getAttribute("javax.servlet.error.error_code") is working.Remaining 4 variables request_uri,message,exception_type,exception are not working.
A blank page is shown when i use the variables. I am pasting my jsp page..Please check the code and tell me where iam doing mistake.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56528
|
|
|
I did not say to do this in a JSP. I explicitly said to do this in a servlet.
|
 |
vipul bondugula
Ranch Hand
Joined: Oct 14, 2010
Posts: 218
|
|
Thanks For Your Reply,
I am using struts framework. Is it proper standard to write servlets for maintaining error pages in struts web application.
Thanks
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56528
|
|
|
It is proper in any web application.
|
 |
 |
|
|
subject: Configurting all errors to single page
|
|
|