Easy Tutorial
❮ Eclipse Jsp Jsp Handling Date ❯

<c:import> Tag

JSP Standard Tag Library

The <c:import> tag provides all the functionality of the <jsp:include> action tag, while also allowing the inclusion of absolute URLs.

For example, you can use the <c:import> tag to include content from different web pages on an FTP server.

Syntax

&lt;c:import
   url="<string>"
   var="<string>"
   scope="<string>"
   varReader="<string>"
   context="<string>"
   charEncoding="<string>"/>

Attributes

The <c:import> tag has the following attributes:

Attribute Description Required Default Value
url The URL of the resource to be imported, which can be a relative or absolute path, and can include resources from other hosts Yes None
context Specifies the name of the resource when using a relative path to access external context resources No Current application
charEncoding The character encoding set of the imported data No ISO-8859-1
var The variable used to store the imported text No None
scope The scope of the var attribute No page
varReader An optional variable to provide a java.io.Reader object No None

Example

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>c:import Tag Example</title>
</head>
<body>
&lt;c:import var="data" url="http://www.tutorialpro.org"/>
&lt;c:out value="${data}"/>
</body>
</html>

The above program will print the source code of the "http://www.tutorialpro.org" page. You can try it yourself.


JSP Standard Tag Library

❮ Eclipse Jsp Jsp Handling Date ❯