wood burning stoves 2.0
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes JSP:INCLUDE Question? 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 "JSP:INCLUDE Question?" Watch "JSP:INCLUDE Question?" New topic


Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10032


With the <jsp:include> standard action, they say that somwhere along the
chain to the included page, some part of the response has been written.
So <% response.addCookie(myCookie); %> or <% response.setHeader("Date", utcFormatDate); %> is simply ignored in the included page. Now when it is like this then what is the effect of actually including a page using <jsp:include> ?? I can rather use <@ include...> Any idea guys?

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10032

Any participants for my post?
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 951

Hope this help

Static Inclusion using @include (Compile time).
Static inclusion involves including the contents of the web component in the jsp file at the time if JSp file is translated, while an dynamic inclusion, the output of another component is included within the output of JSP page when the page is requested.

Since the code of include JSP page become a part if including page, each page can access the variables and methods defined in the other page. (We can not definesame variable and methods in both). They also share all implicit objects.

When an include directive includes the file, the following rules apply.

No processing can be done at translation time, which means the file attribute value can not be an expression.

The included page may or may not compile independently.

Dynamic Inclusion jsp:include (Request Processing time).

The page attribute refers to any static or dynamic web component, including a servlet.
We can pass parameters to dynamically included component by using the <jsp aram /> tag.

In addition to parameters that are explicitly passed using <jsp aram> the included parameters have access to parameters that were originally present in the request to the including component. However, if the original parameter names are repeated in the explicitly passed parameters, the new values take precedence over old values.

Dynamic included pages executes separately, so they do not share the variables and methods defined by the including page. However, they process the same request and thus share all object present in the request scope.
Note that in addition to request, we could use the implicit variables session and application to share objects with included and forwarded pages, but they are not meant for sharing request dependent values


Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
I agree. Here's the link: http://aspose.com/file-tools
subject: JSP:INCLUDE Question?
It's not a secret anymore!