Forums de discussion

Create own custom tag library in Liferay 6.2

thumbnail
Sandip Patel, modifié il y a 7 années.

Create own custom tag library in Liferay 6.2

Regular Member Publications: 205 Date d'inscription: 05/01/11 Publications récentes
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, modifié il y a 7 années.

RE: Create own custom tag library in Liferay 6.2

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
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, modifié il y a 7 années.

RE: Create own custom tag library in Liferay 6.2

New Member Envoyer: 1 Date d'inscription: 18/04/16 Publications récentes
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