tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig McClanahan" <>
Subject Re: some cool hacking projects...
Date Thu, 14 Oct 1999 23:07:47 GMT
Talin wrote:

> > How does this compare with the jsp:forward or jsp:include actions?
> They are both quite different.
> jsp:forward redirects the entire page to a new template page.

Yep, that has its own uses but does not meet the need you are dealing with

> jsp:include is a static inclusion. The included text becomes part of the
> same java class as the overall page.

This ("static inclusion")  is true of the <%@ include file="..." %>
directive, but it is not true for the <jsp:include page="..." /> action.
For the latter, the inclusion is processed at runtime.  You can include the
output from a different JSP page, or from a servlet, in a manner very
similar to your component inclusion description.

> Components are different. Each component is compiled into a seperate
> Java class, using a method which is identical to JSP pages. (And in
> fact, in our system, JSP pages are simply components with no arguments
> that live in a different directory.) So if a component, such as a search
> box or a stock ticker, is used on 10 different pages, there is only one
> copy of the Java code to generate the search box HTML residing in
> memory.

Same with <jsp:include/> -- I like doing this for common banner and
navigation elements in non-framed user interfaces.

> When a component finishes generating content, control returns to the
> calling page, which continues where it left off. A single page may call
> many components, which in tern may call sub-components, etc.

Same with <jsp:include/>.

> The result of this is that the total amount of HTML in our application
> has been reduced by about 1/3.

Same with <jsp:include/>, for the same reasons.

> In addition, the choice of which component is executed can be made at
> the time the page is generated. The name of the component is simply a
> string, which can either be a string literal, or a calculated
> expression. This allows, for example, pages which are customizable by
> end-users, as seen in portal sites such as In our case, it
> allows us to assemble different feature sets for our different affiliate
> partners.

Same with <jsp:include/>, using a request time expression to define the URL
of the page that is included.

> Unlike regular JSP pages, components can be passed arguments when they
> are called. For example, we have a component which displays a set of
> file tabs, allowing the user to select between various "modes". Which
> tab is currently selected is passed as an argument to the component,
> which uses this image to display the appropriate file-tab image.

Same with <jsp:include/> -- you can add query parameters with <jsp:param/>
actions inside the <jsp:include/> action.

Craig McClanahan

View raw message