掲示板

Create own custom tag library in Liferay 6.2

thumbnail
7年前 に Sandip Patel によって更新されました。

Create own custom tag library in Liferay 6.2

Regular Member 投稿: 205 参加年月日: 11/01/05 最新の投稿
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
7年前 に David H Nebinger によって更新されました。

RE: Create own custom tag library in Liferay 6.2

Liferay Legend 投稿: 14916 参加年月日: 06/09/02 最新の投稿
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.
7年前 に kaio thomeo viesi によって更新されました。

RE: Create own custom tag library in Liferay 6.2

New Member 投稿: 1 参加年月日: 16/04/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