• 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

Handling Error in JSP

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having troubles handling error in JSP pages.
I am using JSP page directive to specify an error page. At the top of the page I am including a header file using JSP:include. Now what I expect is that if there is any error then only the error page should be displayed. But actually what is displayed is the header followed by the error page.
I think I sort of know why is this is happening. In the JSP:include the argument "flush" has a value of true. When I try setting it to false, the page doesnt work and the header is not included at all. When I checked up the syntax for <jsp:include> I found that the value is supposed to be true!! If that is the case how do I solve this problem.
Any help in this matter appreciated!
Thanks
Amit
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
try this <%@ page errorPage="someerrorpage.jsp" %>
munaf
 
Amit Chandak
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i tried it already....even it results in same....no difference..
any other suggestions??
 
Sheriff
Posts: 67634
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe that the "flush must be true" restriction has been lifted in recent versions of servlet containers, but if you want to avoid the whole flush-on-include scenario you could include your header with the include directive (as opposed to the include action tag).
 
mohamed munaf
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Did u entered the following code in your web.xml?
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>someerrorpage.jsp</location>
</error-page>
Its working fine for me.In case not check your coding
munnaf
 
Bear Bibeault
Sheriff
Posts: 67634
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
mohamed, I know you are trying to be helpful, but please actually read the original post. He is not having trouble getting an error page to display.
thanks,
bear
 
Your buns are mine! But you can have this tiny ad:
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