Two Laptop Bag
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Repeated page directives Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Repeated page directives" Watch "Repeated page directives" New topic

Repeated page directives

Ajith Kallambella

Joined: Mar 17, 2000
Posts: 5782
Here goes another one.
I know other than the import page directive, none can be repeated within a page. But what happens if you do, for instance end up having two errorPage declarations either typing in directly or as a (hopefully unintended ) consequence of a page include.
One would think it generates a compilation error. However, when I tried this with my JRun3.1, it happily used the second error page. Surprisingly the second errorPage directive superceded the first one.
Is this normal? I hope not
ersin eser
Ranch Hand

Joined: Feb 22, 2001
Posts: 1072
Main page has page directive with errorPage attribute and you want to include another page:
using jsp:include If you include a jsp-page that has page directive with errorPage attribute in it, that should not give you a problem ( request time ).
using include directive If you include jsp-page that has page directive with errorPage attribute in it, than u should get an error since two page directive with errorPage attribute will end up in a single final page ( compilation time )
This is my first thought, I have to try
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Tomcat 4.0.1 on NT.
include Directive: Translation time Error.
Page directive: can't have multiple occurrences of errorPage
include Action:
Scenario: main page had an errorPage. Included(action) another page with an errorPage attribute. Included (action) a third page which is made to throw an ArithmaticException.
Result: errorPage on the main page showed up.
I know that the Exception is being thrown because when I removed the errorPage in the main page I saw the exception on the Browser.
I think in the light of this, its important to know the scope of the "page" directive in the Spec. Seems like Tomcat and JRun behave differently.
- satya

Take a Minute, Donate an Hour, Change a Life
I agree. Here's the link:
subject: Repeated page directives
It's not a secret anymore!