Solved

jsp page include

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Unhandled exception type Exception 18 52
Facing this issue for maven proxy setting 2 27
jsp insert to database example 2 61
removing a class in javascript 4 71
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
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 video teaches viewers about errors in exception handling.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

756 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