Solved

jsp page include

Posted on 2002-07-27
1
177 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 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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.
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

739 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