Friday, March 7, 2014

Developing JSP: starting with JSTL

For introduce last version of JSTL into your project please download last version of jstl jar file. At the moment the 1.2 version.

Click here to download the 1.2 jstl jar file

Here you can find the JSP Standard Tag Library home page: https://jstl.java.net

Start you eclipse project putting the downloaded jar file into the WEB-INF/lib folder.
No more configuration are needed into web.xml(for servlet container with recently version specifications...).

For starting to use it, into the jsp point to the jstl library that you need...
For example:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
[...]
 <fmt:setBundle basename="resources.messages"/>
//here I put my messages.properties file into my sources folder, into resources package...
[...]
<fmt:message key="homepage.title"/>
//this get the property value with homepage.title key


To start there is this Java EE 5 Online Tutorial(Chapter 7 - JavaServer Pages Standard Tag Library)

Instead refer to the online official javadoc for the full tld information.

Bye...

No comments:

Post a Comment