How to search for a taglib's code

(Redirected from Taglib)

Table of Contents [-]

This page describes how to search for the code that implements a taglib that is being used in a JSP. Let's use the following as an example:

 <liferay-ui:search-iterator searchContainer="<%= searchContainer %>" />

First break down the tag a little into its separate parts:

  • liferay-ui
  • search-iterator
  • searchContainer

You can find the liferay-ui param with this path (version 4.2):

 util-taglib/classes/META-INF/liferay-ui.tld

In liferay-ui.tld, search for search-iterator:

 <tag>
    <name>search-iterator</name>
    <tagclass>com.liferay.taglib.ui.SearchIteratorTag</tagclass>
    <bodycontent>JSP</bodycontent>
    <attribute>
        <name>page</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
        <name>**searchContainer**</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
 </tag>

searchContainer is one of the attributes.

To find the path to the JSP, its stored in the tagclass.

 <tagclass>com.liferay.taglib.ui.SearchIteratorTag</tagclass>

In the java class, you'll see a variable with the path to the JSP:

 private static final String _PAGE = "/html/taglib/ui/search_iterator/page.jsp";

Another great way to do this is to use Javadoc. You can find the Javadoc API online in the developer section of the liferay site. Just choose the UTIL-TAGLIB sub project and browse the packages, till you find the tag you are looking for, Select it, then select the "View Source" link.

Additional Resources #

  • Intro to Taglibs (overview of a very basic taglib): http://www.ibm.com/developerworks/java/library/j-jsp07233.html
  • Taglib Tutorial: http://jakarta.apache.org/taglibs/tutorial.html
0 Attachments
25587 Views
Average (5 Votes)
The average rating is 2.8 stars out of 5.
Comments