Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

how to add jsp variable to cq:inlcude path

Ka_On_Leung
Level 2
Level 2

Hi

I have  a component which use to display all the node detail in a specific folder.  But there is some problem when a pass a <%=variable%> to cq:include.  When I read the source using firefox.  It seems it can not read the jsp variable  correctly.  Please help.

 

Below is the source from firefox when I open the page.   cqinclude seems cannot understand <%=noticeName%> is a jsp variable.  It just print it out as it is.

<li id="notice-board-item-12" class="alphabet-a"><div class="parbase notice"> <h1><div><span class="cq-text-placeholder-ipe">&para;</span></div></h1><h2><div><span class="cq-text-placeholder-ipe">&para;</span></div></h2><img src="/libs/cq/linkchecker/resources/linkcheck_o.gif" alt="invalid link: &lt;div&gt;&lt;span class=" title="invalid link: &lt;div&gt;&lt;span class=" border="0">More<img src="/libs/cq/linkchecker/resources/linkcheck_c.gif" border="0"> <script type="text/javascript"> CQ.WCM.edit({"path":"/content/bochk_web/zh_hk/noticeboard/<%=noticeName%>/jcr:content/notice","dialog":"/apps/bochk_web/components/notice/dialog","type":"bochk_web/components/notice","csp":"page_noticeboard|page/noticeboard/notice|parbase","editConfig":{"inplaceEditingConfig":{"active":true,"editorType":"text","configPath":"/apps/bochk_web/components/notice/cq:editConfig/cq:inplaceEditing/../../dialog/items/tab1/items/text"}}}); </script> </div> </li> 

 

 

Below is the source code of the component:

while (noticeBoardChildNodes.hasNext()){ Node notice = (Node) noticeBoardChildNodes.next(); if (notice.hasProperty("jcr:primaryType")){ if (notice.getProperty("jcr:primaryType").getString().equals("cq:Page")){ String noticeName = notice.getName(); //out.println("<li id=\"notice-board-item-" + count + "\" class=\"alphabet-a\"><cq:include path=\"../../" + notice.getName() + "/jcr:content/notice\" resourceType=\"bochk_web/components/notice\" /></li>"); %> <li id="notice-board-item-<%=count%>" class="alphabet-a"><cq:include path="../../<%=noticeName%>/jcr:content/notice" resourceType="bochk_web/components/notice" /></li> <% count ++; } } }
0 Replies