Friday, June 5, 2009

JSTL

What is JSTL?

The JavaServer Pages Standard Tag Library (JSTL) encapsulates, as simple tags, core functionality common to many JSP applications. For example, instead of suggesting that you iterate over lists using a scriptlet or different iteration tags from numerous vendors, JSTL defines a standard tag that works the same everywhere.

You can also download JSTL taglib library from Jakarta apache project online website on http://jakarta.apache.org/builds/jakarta-taglibs/releases/standard/binaries/. Some included jar for JSTL 1.1 library are jaxen-full.jar, jstl.jar, saxpath.jar, standard.jar, xalan.jar. However, only jstl.jar and standard.jar are required.


How to Install JSTL:
1. Download jstl.jar and standard.jar
2. Put those two jar files into /common/lib/ in your Tomcat directory
(All the application under Tomcat will share those jar files inside common/lib/)
3. Below is how your code will looks like if you want to make use of JSTL in your JSP file:





Other taglib that will be used in creating dynamic webpage

We are going to download struts-taglib.jar file. Here is the website where we can find most of the jar files: http://www.java2s.com/Code/Jar/CatalogJar.htm

1. Download the strits-taglib.jar file from that website.
2. Extract the jar file
3. After the jar file has been extracted, you will fid two folders, such as: META-INF and org.
We only care about the META-INF. Open the META-INF and you will find the 'tld' folder.
The files inside the 'tld' folder: struts-bean.tld, struts-html.tld, struts-logic.tld and struts-
nested.tld

Now we will look at the struts-bean.tld.

First, create new folder 'tlib' in your WEB-INF/ directory of your Struts Application. Mine is located here C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\tlib
Copy the struts-bean.tld into tlib folder.

You will need to add struts-taglib.jar file into the /common/lib/ directory of your Tomcat and use your Eclipse - Porject properties to add struts-taglib.jar.



2.

No comments:

Post a Comment

Followers