Hi All,
In my component.html I have the below :
#1] <div data-sly-use.componentUse="${'com.xxx.xxx.componentUse' @ propertyName='properties.relatedPath'}" data-sly-unwrap>
</div>
where "relatedPath" is of type String[] holding values for the below dialog section
<multi
jcr:primaryType="cq:Widget"
fieldLabel="Multi-Field"
hideLabel="{Boolean}true"
name="./relatedPath"
xtype="multifield">
<fieldConfig
jcr:primaryType="nt:unstructured"
xtype="pathfield"/>
</multi>
#2] In my corresponding Java WCMUse class, I have the below :
private static final String PROPERTY_NAME = "propertyName";
private String[] properties;
public void activate() throws Exception {
properties = get(PROPERTY_NAME, String[].class);
But "properties" is always returning null, though the property has two values of pathfields.
#3] Also, I see com.adobe.cq.sightly.WCMUse Failed to cast value
java.lang.ClassCastException: Cannot cast java.lang.String to [Ljava.lang.String; getting logged.
Not sure what am I missing. Any thoughts/pointers/reference/snippet will be really helpful.
Solved! Go to Solution.
Views
Replies
Total Likes
You're passing the literal value 'properties.relatedPath' to the use class, so get(...) is returning that string not the array. Take off the single quotes and it should work:
<div data-sly-use.componentUse="${'com.xxx.xxx.componentUse' @ propertyName=properties.relatedPath}" data-sly-unwrap> </div>
Views
Replies
Total Likes
You're passing the literal value 'properties.relatedPath' to the use class, so get(...) is returning that string not the array. Take off the single quotes and it should work:
<div data-sly-use.componentUse="${'com.xxx.xxx.componentUse' @ propertyName=properties.relatedPath}" data-sly-unwrap> </div>
Views
Replies
Total Likes
Hi
As mentioned by BEN, Please check the quotes.
You are using:-
<div data-sly-use.componentUse="${'com.xxx.xxx.componentUse' @ propertyName='properties.relatedPath'}" data-sly-unwrap>
What you should use is:-
<div data-sly-use.componentUse="${'com.xxx.xxx.componentUse' @ propertyName=properties.relatedPath}" data-sly-unwrap>
See this blog post:- http://blogs.adobe.com/experiencedelivers/experience-management/sightly-intro-part-4/
//
<div>
data-sly-use.mycomp="${ 'com.myproject.MyComponent'
@ param1='value1', param2=currentPage}">
${mycomp.calculatedValue}
</div>
Here value1 is actual string passed, but for current page we have used param2=currentPage.
I hope this will help you.
Thanks and Regards
Kautuk Sahni
Views
Replies
Total Likes
Views
Likes
Replies
Views
Like
Replies