Jahia DX > area, module and...

0 (0 Good)
0 (0 Bad)

area, module and parameters

by  cachavez »  2011/11/26 17:36

Hello all.

I have defined an area like:

<template:area path="logo" moduleType="absoluteArea" listLimit="1" nodeTypes="jnt:myLink"/>

I have defined in the definition.cnd the jnt:myLink and the corresponding jsp: myLink.jsp.

I have been trying to send parameters to myLink.jsp in this way:

<template:area path="logo" moduleType="absoluteArea" listLimit="1" nodeTypes="jnt:myLink">

   <template:param name ="cssClassName" value ="css-value" />

</template:area>

Then in the JSP I tried to get the value with:

renderContext.mainResource.moduleParams.cssClassName or currentResource.moduleParams.cssClassName

but nothing seems to work.

Can anyone know how I can send parameter to my custom jsp ?

--

Cheers.

Carlos Chávez.

  • area, module and parameters
    2011/11/26 17:36

    cachavez <p> Hello all.</p> <p> I have defined an area like:</p> <p> &lt;template:area path=&quot;logo&quot; moduleType=&quot;absoluteArea&quot; listLimit=&quot;1&quot; nodeTypes=&quot;jnt:myLink&quot;/&gt;</p> <p> I have defined in the definition.cnd the jnt:myLink and the corresponding jsp: myLink.jsp.</p> <p> I have been trying to send parameters to myLink.jsp in this way:</p> <p> &lt;template:area path=&quot;logo&quot; moduleType=&quot;absoluteArea&quot; listLimit=&quot;1&quot; nodeTypes=&quot;jnt:myLink&quot;&gt;</p> <p> &nbsp;&nbsp; &lt;template:param name =&quot;cssClassName&quot; value =&quot;css-value&quot; /&gt;</p> <p> &lt;/template:area&gt;</p> <p> Then in the JSP I tried to get the value with:</p> <p> renderContext.mainResource.moduleParams.cssClassName or currentResource.moduleParams.cssClassName</p> <p> but nothing seems to work.</p> <p> Can anyone know how I can send parameter to my custom jsp ?</p> <p> --</p> <p> Cheers.</p> <p> Carlos Ch&aacute;vez.</p>

  • Number of messages  32
    Registration date Nov 26, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: area, module and parameters

    by  dub »  2013/06/03 09:38

    According to the Sitemap Component on GitHub, this should work:

     

     
    <c:if test="${empty currentResource.moduleParams.level}">
        <c:set var="level" value="1"/>
    </c:if>
     
    <c:if test="${not empty currentResource.moduleParams.level}">
        <c:set var="level" value="${currentResource.moduleParams.level}"/>
    </c:if>
     
    <template:module node="${child}" view="sitemap" editable="false">
          <template:param name="level" value="${level +1}"/>
    </template:module>

     

  • Re: area, module and parameters
    2013/06/03 09:38

    dub <p> According to the <a href="https://github.com/Jahia/modules-set/blob/master/sitemap/src/main/webapp/jnt_sitemap/html/sitemap.jsp">Sitemap Component on GitHub</a>, this should work:</p> <p> &nbsp;</p> <div class="line" id="LC19"> &nbsp;</div> <div class="line" id="LC20"> <span class="nt">&lt;c:if</span> <span class="na">test=</span><span class="s">&quot;${empty <strong>currentResource.moduleParams.level</strong>}&quot;</span><span class="nt">&gt;</span></div> <div class="line" id="LC21"> &nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;c:set</span> <span class="na">var=</span><span class="s">&quot;level&quot;</span> <span class="na">value=</span><span class="s">&quot;1&quot;</span><span class="nt">/&gt;</span></div> <div class="line" id="LC22"> <span class="nt">&lt;/c:if&gt;</span></div> <div class="line" id="LC23"> &nbsp;</div> <div class="line" id="LC24"> <span class="nt">&lt;c:if</span> <span class="na">test=</span><span class="s">&quot;${not empty<strong> currentResource.moduleParams.level</strong>}&quot;</span><span class="nt">&gt;</span></div> <div class="line" id="LC25"> &nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;c:set</span> <span class="na">var=</span><span class="s">&quot;level&quot;</span> <span class="na">value=</span><span class="s">&quot;${<strong>currentResource.moduleParams.level</strong>}&quot;</span><span class="nt">/&gt;</span></div> <div class="line" id="LC26"> <span class="nt">&lt;/c:if&gt;</span></div> <div class="line"> &nbsp;</div> <div class="line"> <div class="line" id="LC39"> <span class="nt">&lt;template:module</span> <span class="na">node=</span><span class="s">&quot;${child}&quot;</span> <span class="na">view=</span><span class="s">&quot;sitemap&quot;</span> <span class="na">editable=</span><span class="s">&quot;false&quot;</span><span class="nt">&gt;</span></div> <div class="line" id="LC40"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="nt">&lt;template:param</span> <span class="na">name=</span><span class="s">&quot;level&quot;</span> <span class="na">value=</span><span class="s">&quot;${level +1}&quot;</span><span class="nt">/&gt;</span></div> <div class="line" id="LC41"> <span class="nt">&lt;/template:module&gt;</span></div> </div> <p> &nbsp;</p>

  • Number of messages  1
    Registration date Jun 3, 2013
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page