Skip to content

Instantly share code, notes, and snippets.

@wmfairuz
Created June 1, 2014 10:23
Show Gist options
  • Save wmfairuz/7bf54fb1aa77af9fae4e to your computer and use it in GitHub Desktop.
Save wmfairuz/7bf54fb1aa77af9fae4e to your computer and use it in GitHub Desktop.
custom taglib
example:
A Java file: src/main/java/org/jahia/modules/survey/taglib/FormFunctions.java
Declare taglib in TLD: src/main/resources/META-INF/jahia-survey.tld
<description>Jahia Survey module tag library</description>
<display-name>Jahia Survey Service</display-name>
<tlib-version>1.0-SNAPSHOT</tlib-version>
<short-name>survey</short-name>
<uri>http://www.jahia.org/tags/survey</uri>
<function>
<name>getFormFields</name>
<function-class>org.jahia.modules.survey.taglib.FormFunctions</function-class>
<function-signature>java.util.Map getFormFields(org.jahia.services.content.JCRNodeWrapper)</function-signature>
</function>
Use in jsp:
<%@ taglib prefix="survey" uri="http://www.jahia.org/tags/survey" %>
<c:set value="${survey:getFormFields(currentNode.parent)}" var="formFields" scope="request"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment