JSP Tags – Installing JSTL

So in this tutorial, we are going to learn how install the JSP Standard Tag Library for use with your JSP applications. So let’s jump right into it.

Open up eclipse and create a new project. You are going to want to create a new “Dynamic Web Project”.


Name the project as “tagdemo” and leave everything else as default and click on finish. Now you’ll have an empty project. Just expand the WebContent folder, under the Web-INF folder you are going to have a lib folder, you shouldn’t have anything under there. Here you are going to add a couple of jar files in order to be able to use the JSTL. Open up a browser and go to http://jstl.java.net.


Click on Download and on the next page, you want the JSTL Implementation. Click on that and you’ll be redirected to a repository containing the jar files available for JSTL. For the purpose of this tutorial, we are going to select “javax.servlet.jsp.jstl-1.2.1.jar”, because it is simple and easy to use. Go ahead and download the file.

After downloading the file, locate the jar file in your filesystem and copy it. Paste it in the WebContent->WEB-INF-> lib folder. Now you can expand the lib folder and see the file located inside it.


Now we can start using it. Bow just go ahead and create a new file under the WebContent Folder and name it “test.jsp” and click on Finish. The file will automatically open.

Sample Code

Let’s go ahead and code it:

<%@ tagliburi="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:setvar="stuff" value="<%= new java.util.Date() %>" />

        Time on the server is ${stuff}


The tag before the html tag is plainly just referencing the JSTL with a specific uri. Then the prefix is specifying that you are only going to use the core tags.

In the body, you are using the set tag to assign a value to the variable stuff. And then we are using the regular syntax to display the value of stuff we set earlier. So now when we run it, we get this:


So, we learnt how to use the JSTL core library, and set value of a variable. Moving ahead we are going to learn how to do the fancy stuff with JSTL.

Installation for the Advanced Functions

For implementing the advanced functionalities, you need to add another file to your project. Head back to the JSTL site, click on download and now click on JSTL API. You’ll be taken to the repository where you need to find the “javax.servlet.jsp.jstl-api-1.2.1.jar” file. Go ahead, download the file and include it in the lib folder just as you did with the last file.

Now we are really set up for everything. In the next tutorial we are going to see how to go about the rest of it,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to top Search