Struts Tags Libraries, Types of Struts Tag Libraries, How you can use on JSP ? and basic required configurations.

Struts Tags Libraries, Types of Struts Tag Libraries, How you can use on JSP ? and basic required configurations.

Previous Home Next

 

Struts provides various custom tags libraries to map the objects of model of our struts based applications to the view. As in our past topics we had not cover more about Struts JSP Tags Libraries. Now we are going to cover deeper about Struts Custom Tags. Struts Frameworks has HTML tags, bean tags, and logic tags etc.

 Types of Struts Tags Libraries: Struts Frameworks has following custom tags 

1. HTML Tag Library 
2. The Bean Tag Library 
3. The Logic Tag Library 
4. The Nested Tag Library 
5. Template tag library 
6. Tiles tags Library 

We will cover more about these all in our next sections one by one. 

Using a Custom Tag Library: 

To use struts tag library we must configure the tag library and make the class files(jars) available to the web application’s classloader. 

 To do so we have copy jars into WEB-INF/lib directory of our web application.Once the tags libraries are available to the web application classloader, You can do following steps to use struts tags on JSP View. 

1. Copy the all TLD file (like struts-html.tld) to the WEB-INF directory of your web application. 
2. Add the following element to your web.xml file (WEB-INF/web.xml). struts-html /WEB-INF/struts-html.tld 

Add the following taglib directive to the JSP to import the tag library on your JSP page 

 <%@ taglib uri="struts-html" prefix="html" %> 

 Now you can start to make a JSP page using Struts Tags Library.


Previous Home Next