aspose file tools*
The moose likes JSP and the fly likes isErrorPage and errorPage attributes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "isErrorPage and errorPage attributes" Watch "isErrorPage and errorPage attributes" New topic
Author

isErrorPage and errorPage attributes

Poonam Kadu
Ranch Hand

Joined: Jul 21, 2006
Posts: 49
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

Joined: May 29, 2009
Posts: 122
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

Joined: Jun 17, 2010
Posts: 44
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
Nilesh Miskin
Ranch Hand

Joined: Jun 17, 2010
Posts: 44
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.
 
jQuery in Action, 2nd edition
 
subject: isErrorPage and errorPage attributes