Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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)
 
My first bit of advice is that if you are going to be a mime, you shouldn't talk. Even the tiny ad is nodding:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic