留言板

Create own custom tag library in Liferay 6.2

thumbnail
Sandip Patel,修改在7 年前。

Create own custom tag library in Liferay 6.2

Regular Member 帖子: 205 加入日期: 11-1-5 最近的帖子
Hi,
I want to create my own custom tag library in Liferay. The custom tag library have input parameter as categoryId and and from that categoryId I need to get documents related to it.
Which plugin I have to use to create own custom tab liberary. Is it hook or portlet ? And how to develop it.

Thanks,
Sandip Patel
thumbnail
David H Nebinger,修改在7 年前。

RE: Create own custom tag library in Liferay 6.2

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
A tag library is, at it's heart, a bunch of java classes along with a TLD descriptor - effectively just a jar.

You can deploy your jar using an EXT plugin to share or with each dependent plugin to use only where needed.
kaio thomeo viesi,修改在7 年前。

RE: Create own custom tag library in Liferay 6.2

New Member 发布: 1 加入日期: 16-4-18 最近的帖子
Hi,

Create a dir in WEB-INF with name tags (WEB-INF/tags).
Create files with extension .tag. Example: my-taglib.tag
In tag file, import:

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui"%>
<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet"%>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme"%>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui"%>


To receiver parameters:

<%@ attribute name="parameter" required="true" type="java.lang.String"%>


To import taglib in jsp file:

<%@ taglib tagdir="/WEB-INF/tags" prefix="prefix"%>


To use:
<prefix:my-taglib parameter="Hello Word" />


LINK: http://docs.oracle.com/javaee/1.4/tutorial/doc/JSPTags5.html