The JSP Standard Taglibrary (JSTL) provides simple tags, encapsulating several core functionalities, to be added to any JSP application. As example, you can get tags to store and display variables, to make iterations, for XML manipulation, Input / Outputing , and so on.

This post explain how to setup a page with JSTL and make some examples for common tags.

Install JSTL

To use a tag library you need to import the jar libraries containing the implementation and define tags that invoke functions inside the library.

install JSTL by adding jar under lib folder

You can find jstl-1.2.jar on the web or from there: JSTL-1-2 (local archive).


Since the jat we’ve copied contains both libraries and TLD definitions, we can start to use JSTL tags. To use them, first we need reference JSTL with a declaration at top of JSP. In the shippet below we reference the jstl/core library, whose tags are available under the prefix “c:” .

Then we could put some JSTL tags inside the page.


In the snippet above we used

  • c:import to read a file on the server, and store content inside a varuable
  • c:out to output the content of a variable to the page (you could escape xml)

See the screenshoot below


To make some further test with the jstl/core we insert another two snippet, for loops. The first show a simple loop that build a table

The second list page parameters. Take care that param is an implicit Map object.


The result, obvious, are a table and a list. But instead to watch the picture,  you can build yourself.