Solved

jsp page include

Posted on 2002-07-27
1
171 Views
Last Modified: 2013-11-18
Experts

What's the difference between these two jsp syntax?

case 1:   <%@include file='apple.jsp'%>
case 2:   <jsp:include page="apple.jsp" />

Thanks a lot
glogin :-)
0
Comment
Question by:glogin
1 Comment
 
LVL 35

Accepted Solution

by:
girionis earned 50 total points
Comment Utility
> <%@include file='apple.jsp'%>

  This is called "include directive". It includes the contents of a file within the calling file. This inclusion takes place during compile time. For example:

example.jsp

<html>
    <body>
        <%@ include file='apple.jsp'%>
    </body>
</html>

apple.jsp

<h3>
    <%out.println("this is an apple");%>
</h3>

  then the example jsp after copilation will look like:

<html>
    <body>
        <h3>
            <%out.println("this is an apple");%>
        </h3>
    </body>
</html>

> <jsp:include page="apple.jsp" />

  This is called "include action". It executes the specified page first (in our case the apple.jsp page) and then includes the generated response in the calling JP page. This takes place during run-time.

  Since it includes the generated response, variables and other values specified within the calling JSP page are not available to page that was called (apple.jsp).

  You should also include a "flush" attribute to force a flush of the buffer to the outpu stream:

  <jsp:include page="apple.jsp" flush="true"/>

  Hope it helps.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now