How to search for a taglib's code (from wiki)

本文介绍了一种在Java Server Pages (JSP) 中查找特定TagLib实现代码的方法。以<liferay-ui:search-iterator>为例,详细展示了如何通过liferay-ui.tld文件找到对应的Java类及JSP文件路径。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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.

[edit]

Additional Resources

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值