• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP Exception Handler problem

 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have set up an errorPage handler (ExceptionHandler.jsp) for my JSP page, Main.jsp. If the Main.jsp throws an exception from some of its early code, ExceptionHandler.jsp shows correctly.

But if Main.jsp throws an exception later on in its code, its previous ouput to the client isn't cleared and gets sent to the client along with the ExceptionHandler.jsp output - usually resulting in the user seeing a blank screen.

So how can I make it so that when ExceptionHandler.jsp is called, none of Main.jsp output is sent?

Cheers,
James
 
Karup Mew
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post your code snippet here
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65532
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once the buffer has been flushed there's no recalling it.

Your best bet is to follow modern accepted best practices with regards to web app design and do all the "heavy lifting" in the page controller servlet before the JSP is even dispatched, keeping all Java code out of the JSP.
 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, cheers
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!