Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

jsp page include

Posted on 2002-07-27
1
Medium Priority
?
180 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 35

Accepted Solution

by:
girionis earned 200 total points
ID: 7181864
> <%@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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
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 look for a specific file type in a local or remote server directory using PHP.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

670 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