Skip to content

Instantly share code, notes, and snippets.

@david-hosier
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save david-hosier/734cc8680902358eded9 to your computer and use it in GitHub Desktop.
Save david-hosier/734cc8680902358eded9 to your computer and use it in GitHub Desktop.
Custom Tag in CQ
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<taglib 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/web-jsptaglibrary_2_1.xsd" version="2.1">
<tlib-version>1.0</tlib-version>
<short-name>aauwww</short-name>
<uri>http://foo.bar/aau/taglib</uri>
<tag>
<name>testAndTargetEnabled</name>
<tag-class>net.ftlines.wcm.aau.taglib.TestAndTargetEnabledTag</tag-class>
<body-content>JSP</body-content>
</tag>
</taglib>
Caused by: java.lang.NoSuchMethodError: net.ftlines.wcm.aau.taglib.TestAndTargetEnabledTag.setJspContext(Ljavax/servlet/jsp/JspContext;)V
at org.apache.jsp.apps.aauwww.components.page.page.body_jsp._jspx_meth_aauwww_005ftestAndTargetEnabled_005f0(body_jsp.java:250)
at org.apache.jsp.apps.aauwww.components.page.page.body_jsp._jspService(body_jsp.java:185)
at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:502)
package net.ftlines.wcm.aau.taglib;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
import net.ftlines.util.PropertyUtils;
public class TestAndTargetEnabledTag extends TagSupport {
@Override
public int doStartTag() throws JspException {
if (PropertyUtils.isTestAndTargetEnabled()) {
return EVAL_BODY_INCLUDE;
}
return SKIP_BODY;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment