UNABLE TO READ COMPOUND TYPE MODULE BEANS IN FTL

37 views
Skip to first unread message

raja harivansh

unread,
Dec 14, 2017, 2:30:09 AM12/14/17
to Hippo Community
Hi People,

SCENARIO: I have a compound type and a document type. 
Now this compound type can be added either as a content block or added as a compound type directly in the document type.

When using it as a content block, the content authored in it is displayed correctly. 

However, when I use it as a compound type(directly added in the document type), i cannot access its module in the ftl. 

NOTE: HOWEVER, I can read the module and its values in the component class using the getter method. I just CANT ACCESS the same value in the ftl !!

Here's the calling ftl-
<#import "../../common/components/iframe-module-macro.ftl" as iframeModuleMacro/>
<div class="imc-content--full-width-block">
                <#if  pageModelMap.modelMapData.module.iFrameModule?? && pageModelMap.modelMapData.module.iFrameModule?has_content>
                <@iframeModuleMacro.displayIframeModule iFrameModule=pageModelMap.modelMapData.module.iFrameModule/>
                </#if>
                </div>
Here's the macro- 
<#include "../imports.ftl">
<#macro displayIframeModule iFrameModule>
<#if iFrameModule??> 
<!-- Vertical Rhythm -->
<#assign marginBottom="xlarge" > <#--[none, micro, xxsmall, xsmall, small, mediumsmall, medium, large, xlarge, xxlarge, xxxlarge, jumbo, collosal]-->
<#if marginBottom != "none" >
<#assign verticalRhythmClass="imc-vr--${marginBottom}">
<#else>
<#assign verticalRhythmClass="">
</#if>
<#assign iframePath = iFrameModule.sourceUrl/>
<#assign dataXpath = "IFrame Integration" > <!-- This will be updated once Page metadata component is set and picked from those values-->
<section class="imc-section imc-content imc-section--padded imc-content--border ${verticalRhythmClass}" data-xpath="${dataXpath}" >
<iframe src="${iframePath}" height="615px"></iframe>
</section>
</#if>
</#macro>
Here's the module ftl- 
<#import "../../common/components/iframe-module-macro.ftl" as iFrameMacro/>
<@iFrameMacro.displayIframeModule iFrameModule=moduleBean.modelMapData.module />
 
LOGS- 
[WARNING] [talledLocalContainer] 12:54:15 WARN  [HstFreemarkerServlet] When call
ing macro "displayIframeModule", required parameter "iFrameModule" (parameter #1
) was specified, but had null/missing value.
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] ----
[INFO] [talledLocalContainer] Tip: If the parameter value expression on the call
er side is known to be legally null/missing, you may want to specify a default v
alue for it with the "!" operator, like paramValue!defaultValue.
[INFO] [talledLocalContainer] ----
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] ----
[INFO] [talledLocalContainer] FTL stack trace ("~" means nesting-related):
[INFO] [talledLocalContainer]   - Failed at: #macro displayIframeModule iFrameMo
dule  [in template "webfile:/freemarker/common/components/iframe-module-macro.ft
l" in macro "displayIframeModule" at line 2, column 1]
[INFO] [talledLocalContainer]   - Reached through: @iframeModuleMacro.displayIfr
ameModul...  [in template "webfile:/freemarker/portal/pages/dashboard-page.ftl"
at line 25, column 17]

PS: I can read all the other modules in the document , except this one

Any idea why this could happen?? I've been tearing my hair over this for days now and its been in vain.

Jeroen Hoffman

unread,
Dec 15, 2017, 3:41:05 AM12/15/17
to hippo-c...@googlegroups.com
Hi,
Any luck yet? It looks alright indeed.

Perhaps it's better when you first do an #assign, then call the macro with that variable? Else debug the getters? A full rebuild?

HTH
Jeroen


 


--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-community@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-community+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.

Woonsan Ko

unread,
Dec 15, 2017, 11:56:40 AM12/15/17
to hippo-c...@googlegroups.com
My bet is, the exception occurred in your "module ftl" because you don't have any checking (?? and ?has_content), unlike your "calling ftl".
Can you add that checking here as well and see what happens and why?

Regards,

Woonsan

 
 
LOGS- 
[WARNING] [talledLocalContainer] 12:54:15 WARN  [HstFreemarkerServlet] When call
ing macro "displayIframeModule", required parameter "iFrameModule" (parameter #1
) was specified, but had null/missing value.
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] ----
[INFO] [talledLocalContainer] Tip: If the parameter value expression on the call
er side is known to be legally null/missing, you may want to specify a default v
alue for it with the "!" operator, like paramValue!defaultValue.
[INFO] [talledLocalContainer] ----
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] ----
[INFO] [talledLocalContainer] FTL stack trace ("~" means nesting-related):
[INFO] [talledLocalContainer]   - Failed at: #macro displayIframeModule iFrameMo
dule  [in template "webfile:/freemarker/common/components/iframe-module-macro.ft
l" in macro "displayIframeModule" at line 2, column 1]
[INFO] [talledLocalContainer]   - Reached through: @iframeModuleMacro.displayIfr
ameModul...  [in template "webfile:/freemarker/portal/pages/dashboard-page.ftl"
at line 25, column 17]

PS: I can read all the other modules in the document , except this one

Any idea why this could happen?? I've been tearing my hair over this for days now and its been in vain.

--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-community@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-community+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.

raja harivansh

unread,
Dec 16, 2017, 5:20:51 AM12/16/17
to Hippo Community
@Woonsan

No that didnt work either. :( 

@Jeroen
Apologies.. I didnt quite get that :P .Could you please show what you meant?

raja harivansh

unread,
Dec 20, 2017, 4:28:23 AM12/20/17
to Hippo Community
Hi All,

I pin pointed the error. 
I had been using the pageModelMap.modelMapData.module.IFrameModule with a smaill "i" instead of capital "I". 

                <@iframeModuleMacro.displayIframeModule iFrameModule=pageModelMap.modelMapData.module.iFrameModule/>
instead of 
pageModelMap.modelMapData.module.IFrameModule        (Correct one)

Which is strange since the class' insternal name starts with a small "i"
@HippoEssentialsGenerated(internalName = "imc:iFrameModule")
@Node(jcrType = "imc:iFrameModule")
public class IFrameModule extends AbstractHandlerModule { }
 
Perhaps some issue with name resolutions of modules starting with "i". 

oh well..

Thanks @Jeroen and @Woonsan

Woonsan Ko

unread,
Dec 20, 2017, 12:19:33 PM12/20/17
to hippo-c...@googlegroups.com


On Dec 20, 2017, at 4:28 AM, raja harivansh <hariva...@gmail.com> wrote:

Hi All,

I pin pointed the error. 
I had been using the pageModelMap.modelMapData.module.IFrameModule with a smaill "i" instead of capital "I". 

                <@iframeModuleMacro.displayIframeModule iFrameModule=pageModelMap.modelMapData.module.iFrameModule/>
instead of 
pageModelMap.modelMapData.module.IFrameModule        (Correct one)

FreeMarker finds properties by standards Java Beans API. So when you use ‘something.foo’ it actually invokes ‘something.getFoo()’ getter method, or ‘something.isFoo()’ for [Bb]oolean property.
When you use ‘...module.IFrameModule’ which getter method from ‘module’ instance is supposed to be invoked?
Could you copy and paste the method signature?




Which is strange since the class' insternal name starts with a small "i"
@HippoEssentialsGenerated(internalName = "imc:iFrameModule")
@Node(jcrType = "imc:iFrameModule")
public class IFrameModule extends AbstractHandlerModule { }
 
Perhaps some issue with name resolutions of modules starting with "i". 

oh well..

Thanks @Jeroen and @Woonsan

--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-c...@googlegroups.com

RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages