Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp:include error handling  RSS feed

 
clay jay
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My web.xml is set up so any thrown exceptions go to my error page which works great on everything except in this one scenario. In my page1.jsp I have the following include below:

When an exception is thrown from page2, a stacktrace is printed in my console along with the correct exception type thrown. But when I get to my error page the exception is a JasperException and all my exception information is lost so I can't log proper messages or display an accurate error message to the user.

So I'm assuming I'm missing something simple to get this working properly as there must be a way to have the correct exception in my error page thrown from an included jsp page. Thanks in advance for any help.
 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is isErrorPage set to true and errorPage declared for page2.jsp?
 
clay jay
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
isErrorPage is set to true in my error.jsp and it works properly in every other situation.

As for errorPage I have tried both scenarios. Having errorPage set I just get a blank screen and view source shows nothing. If errorPage is not set it makes it to my error page but with the JasperException instead of my custom exception. Every other page that works properly I do have errorPage set.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the root cause of the JasperException contain anything interesting?

And, if the include is causing problems, have you considered using alternatives? Does it have to be a run-time include?
 
clay jay
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah thanks Bear. If I check the root cause I do see my custom exception and can get the correct messages I need.

Also you are correct in that I should have done this another way in the first place. This was my first web project and I developed it on my own from scratch so I've done things that are frowned upon only realizing it much later and this is one of those cases. Right now this scenario I am just pulling text from a properties file from within page2.jsp to display to the user in a div within page1.jsp. I'm assuming I should be using a tag library in this scenario instead of a runtime include as I actually am running scriptlets in page2.jsp which I should avoid correct?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All correct!
 
clay jay
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, thanks very much for the help and feedback.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!