• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Having problem with error-page

 
Shivakanth Thyagarajan
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where did you place the ErrorPage.jsp?
 
Shivakanth Thyagarajan
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi vishnu,
ErrorPage.jsp is in the same directory CoreJsps as the mainpage.jsp.
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

ErrorPage.jsp is in the same directory


Try placing ErrorPage.jsp in context root(Immediately below your web-application directory)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic