Mark Juliano wrote:

> I was wondering if any of you knew or had thoughts about the performance hit, if
> any, you take when you use a JSP Include rather than type HTML into your JSP
> file.   I know that regardless, both the HTML and the JSP Include get compiled
> into a Servlet so I wasn't sure if in the end there was a difference.
>

There are actually three approaches you can take (because there are two kinds of
"includes" in JSP):

(1) Type the text of the HTML directly into your JSP page

(2) Use the <%@ include file="xxx.html" %> directive, which
    is processed at compile time.

(3) Use the <jsp:include page="xxx.html" flush="true"/> action,
    which is processed at runtime.

The differences between the approaches will tell you which to use for what
circumstance:

- Approach (1) doesn't allow you to re-use existing blocks without
  copying.

- Approaches (1) and (2) are both processed at compile time, so
  they have identical runtime performance.

- Approach (3) has a small runtime overhead, but probably not
  visible compared to network delays and other things going on
  (benchmarks of your own environment are the only way to tell
  if it is truly significant or not).

- Approach (3) lets you choose what page to include dynamically
  if you wish to.

- Approach (3) lets you call "include" on the output from another
  JSP page or servlet that is also generated dynamically.


>
> Thanks...
> -Mark
>

Craig McClanahan

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to