On Tue, 11 Dec 2001, Jeff Kilbride wrote:

> Date: Tue, 11 Dec 2001 11:18:52 -0800
> From: Jeff Kilbride <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: Re: Change an include file requires re-compiling all JSP that
>     include it (?)
>
> If your included files don't contain any JSP code, you can use the
> <jsp:include... /> directive. This directive includes the file at request
> time, rather than page translation time -- so changes to your included file
> will show up immediately.
>
> If your included files contain JSP code, then you're stuck with using the
> <%@ include... %> and you'll need to recompile all your JSPs whenever the
> included file changes.
>

There are no restrictions on using JSP pages (or servlets) in a
<jsp:include/> action at runtime.  This is commonly used, for example, in
a portal-type user interface where the page requested by the user is
essentially a "template" made up of <jsp:include> calls to get all of the
components -- each of which is dynamically created by its own JSP page.

The way to remember the difference (especially if you are a reformed C/C++
programmer :-) is this:

* The "<%@ include %>" directive happens at compile time,
  just like the "#include" directive of C or C++.

* The "<jsp:include />" action happens at runtime, and is
  just a subroutine call.  (In reality, it uses a
  RequestDispatcher from the Servlet API under the covers.)

> Thanks,
> --jeff
>

Craig McClanahan


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to