Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Having problem with error-page

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where did you place the ErrorPage.jsp?
 
Shivakanth Thyagarajan
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
reply
    Bookmark Topic Watch Topic
  • New Topic