Fórum

Use of jsp tagfiles in Liferay dxp?

Jari Jokisalo, modificado 6 Anos atrás.

Use of jsp tagfiles in Liferay dxp?

New Member Postagens: 7 Data de Entrada: 07/05/15 Postagens Recentes
Hello! Any ideas how to use jsp tagfiles in MVCPortlet in dxp? Deploying with tagdir /WEB-INF/tags and adding the directory into jar results into portlet not rendering without any errors. Using /META-INF/tags as tagdir results into 'Tag file directory /META-INF/tags does not start with "/WEB-INF/tags"'.
thumbnail
Rasto Rehak, modificado 6 Anos atrás.

RE: Use of jsp tagfiles in Liferay dxp?

Junior Member Postagens: 66 Data de Entrada: 08/03/07 Postagens Recentes
Good question, I would like to know answer too.
Jari Jokisalo, modificado 6 Anos atrás.

RE: Use of jsp tagfiles in Liferay dxp?

New Member Postagens: 7 Data de Entrada: 07/05/15 Postagens Recentes
Imo it's not possible to use tagfiles atm. Here is my workaround:
- Use a tld in current portlet. I stole the tld from a Liferay jira ticket. Had some really strange problems using my own .tld file.

/META-INF/resource/test.tld


<!--?xml version="1.0"?-->
<!-- This does not work if file name or uri is changed??????????? -->
<taglib version="2.1" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd">
	<tlib-version>1.0</tlib-version>
	<short-name>example</short-name>
	<uri>http://liferay.com/tld/example</uri>
	<tag-file>
		<name>accordion-item</name>
		<path>/META-INF/tags/accordion-item.tag</path>
	</tag-file>
</taglib>


In jsp:
&lt;%@ taglib prefix="custom" uri="http://liferay.com/tld/example" %&gt;


For me changing tld filename from test.tld breaks the jsp (????????) also changing tld uri will add the wrong osgi require capabality into bnd so not changing these work. Don't have time to investigate this so whatever.

Also there are crazy bugs in using the custom tags:
- Using jstl tags in custom tags break randomly the tag. For example in one tag c:if is OK but c:forEach breaks. I suspect this has something to do with tags that use tag body. Same goes for your custom tags.
- Not sure if this is a bug but referring to tag attributes with ${attr} does not work, i'm using <%= attr %>. At least some sources indicate ${attr} should work.
Jari Jokisalo, modificado 6 Anos atrás.

RE: Use of jsp tagfiles in Liferay dxp?

New Member Postagens: 7 Data de Entrada: 07/05/15 Postagens Recentes
SO OK typed a reply outlining my workarounds that got flagged as spam. This happens super often uhh. Here is my reply in gist

Tbh this seems quite broken in Liferay 7. From what i found also creating a module that provides the taglib works.