Solved

jsp page include

Posted on 2002-07-27
1
175 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
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

Suggested Solutions

Title # Comments Views Activity
Should localization be done inside spring controller 5 32
java stored proc example 9 44
hibernate example for saving data 19 52
Problem to Alipay 10 41
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

789 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