Skip to content

Import JSTL Custom tags to Adobe CQ5

October 26, 2012

Steps to add JSTL 2.0 custom tags to Adobe CQ5:

1. Create custom tag

Create your own custom tag at location say /apps/myproject/taglibs/foo.tag and the contents of the tag are as below:

<%@ attribute name="greeting" required="true" %>
<%@ attribute name="name" required="true" %>
<h1>Im a custom taglib [${greeting}, ${name}]</h1>

2. Use tags in a html or jsp page:
To use Custom Tag Lib Files within CQ5 and you can just add a tag file somewhere on the JCR and reference it via

<%@ taglib tagdir="/WEB-INF/tags/apps/myproject/taglibs" prefix="ctags" %>
<ctags:foo greeting="Hello" name="CQ User"/>

Note that the “/WEB-INF/tags/” need to be prefixed the path where the tag libs exist.

3. Add below code to the maven-assembly plugin

<assembly> 
....
<filesets>
  <fileSet>
    <directory>src/main/content/jcr_root</directory>
    <outputDirectory>jsp-dependencies/jcr_root/WEB-INF/tags</outputDirectory>
    <includes>
    <include>**/*.tag</include>
    </includes>
  </fileSet>
 </filesets>
  ....
</assembly> 

The output directory filter need to be created for the tag as the custom tags need to be copied from /apps/myproject/taglibs to WEB-INF/tags/apps/myproject/taglibs.

Advertisements

From → Uncategorized

One Comment
  1. is there any way to accomplish this without maven? I.E purely in CQ/CRX DE Lite

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: