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!
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.
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