wood burning stoves 2.0*
The moose likes JSP and the fly likes Having problem with error-page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Having problem with error-page" Watch "Having problem with error-page" New topic
Author

Having problem with error-page

Shivakanth Thyagarajan
Ranch Hand

Joined: Mar 28, 2005
Posts: 41
Hi,
I was going through HFSJ, i came across this tag <error-code> in web.xml, I developed a JSP page ErrorPage.jsp and assigned it to <error-code> as follows.
Code Snippets
<error-page>
<error-code>404</error-code>
<location>/ErrorPage.jsp</location>
</error-page>

In my JSP page i tried to open a non-existent page and expecting a 404 error, which should have proceeded through to ErrorPage.jsp, but instead it is showing the page cannot be displayed. When I remove the above code from web.xml i am able to view 404 error. I am pasting the ErrorPage.jsp and the code to access the non-existent page.

ErrorPage.jsp

<%@ page isErrorPage="true" %>
<html>
<body>
<strong> Bummer.</strong>
<img src="images/Web.jpg">
</body></html>



Jsp code to access the non-existent page.

<form action="inputAction.jsp" name="HelloForm">
<Script language="JAVASCRIPT">
document.HelloForm.submit() ;
</Script>
</form>

Thanks
Shivakanth.T
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
Where did you place the ErrorPage.jsp?


Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Shivakanth Thyagarajan
Ranch Hand

Joined: Mar 28, 2005
Posts: 41
Hi vishnu,
ErrorPage.jsp is in the same directory CoreJsps as the mainpage.jsp.
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026

ErrorPage.jsp is in the same directory


Try placing ErrorPage.jsp in context root(Immediately below your web-application directory)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Having problem with error-page