• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

isErrorPage and errorPage attributes

 
Poonam Kadu
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
I was trying out a simple example of isErrorPage and errorPage ...follwing is the code

TestJSP1.jsp



ErrorHandler.jsp



When i execute TestJSP1.jsp for the first time ,it seems as if the exception is not thrown and Hello World is printed...then when i refresh the same page, exception is thrown and 'Sorry there was an error.Please try again!!!' is printed...Why didn't TestJSP1.jsp throw an exception when executed for the first time itself?

cheers,
Poonam.
 
Mark Wa
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure. try putting your code in the <head> ? - also you dont need to put it in a loop. or an if statement. just throw the exception.
 
Nilesh Miskin
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Poonam,

This looks to me an issue related to your browser. Perhaps because of the way the browser caches the pages. If you are using Internet Explorer, I will suggest you try following settings: Tools-> Internet Options - > Temporary Internet Files-Settings ->
Here, for 'Check for newer versions of pages' choose 'Every visit to the page'. The default option is 'Automatically'.
Now it should work the way it is supposed to be.
Note: Browser settings may change depending on the browser & the version.
 
Nilesh Miskin
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark Wa wrote:Not sure. try putting your code in the <head> ? - also you dont need to put it in a loop. or an if statement. just throw the exception.


I think she purposefully put the code in if statement. If she didn't so & had tried to throw exception straightaway, the code would not compile because the 'Hello World' statement would become unreachable.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic