JSTL
Posted on: March 12, 2008 at 12:00 AM
The disadvantage of using the or the include directive is that we can only include the content or files which are the part of the current web application.

JSTL <c:import> 

        

The disadvantage of using the <jsp:include> or the include directive is that we can only include the content or files which are the part of the current web application. But by using the jstl <c:import> we can also include those contents or files which are not a part of the current web application but lying somewhere outside the web application. So, the jstl <c:import> is more useful than the <jsp:include> .

In the example given below we are going import one file which is in the current web application. This tag works like the <jsp: include> but it is much more flexible and powerful. In this program we have used only one attribute of <c:import> that is url in which we will specify the path of the file which we want to import in our file. 

 

The code of the program is given below:

 

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<html>
<head>
<title>This page is imported</title>
</head>
<body>
<c:import url = "Date.jsp"/>
</body>
</html>

The output of the program is given below:

Download this example.

Related Tags for JSTL :
cflexwebjspfileideurlfilesstlantapplicationimportpathioincludesedjstlportcontenttagattributeusingthisidapplikejsifexamplewhereworkprogramlextoramexampowerxibcieilitdirectivenotlscanliuseulpeimartcurrentinnopartmntoutpartrsidsidewanoscaosjadadvantageclesspecdiragemeproppcatxawhichwerxampsrectspsodirectcontentsatkincisirhallivmplgoflexibleandarrtsawantvattxissrirenthavbelostatiaphatexilsoicaicapleplprndonlyonomogronl


More Tutorials from this section

Ask Questions?    Discuss: JSTL  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.