Hi
I have a component SightlyTest in which i have following file :
SightlyTest.html :
Hello Sightly ${properties.description} <div data-sly-use.extra="extra1.html"> <div data-sly-call="${extra @ text=properties.description}"></div> </div>
extra1.html :
<template data-sly-template.extra="${@ text}" data-sly-use.extraHelper="${'ExtraHelper' @ text=text}"> <p>${extraHelper.reversedText}</p> </template>
ExtraHelper.java :
package apps.AEMProject.components.content.SightlyTest; import com.adobe.cq.sightly.WCMUse; public class ExtraHelper extends WCMUse { private String reverseText; @Override public void activate() throws Exception { String text = get("text", String.class); reverseText = new StringBuffer(text).reverse().toString(); } public String getReverseText() { return reverseText; } }
But noting shows as output, what i can see only Hello Sightly . ${properties.description} shows the value of property.
Any Idea.
Solved! Go to Solution.
Views
Replies
Total Likes
Can you change this to all lowercase, and then also change the package of your Java-class to all lowercase?
To me this is likely the cause...
Views
Replies
Total Likes
hi ,
Can you try this?
<div data-sly-call="${extra.extra @ text=properties.description}"></div>
You have data-sly-use.extra, and your template is also called extra.
Views
Replies
Total Likes
Feike Visser wrote...
hi ,
Can you try this?
<div data-sly-call="${extra.extra @ text=properties.description}"></div>
You have data-sly-use.extra, and your template is also called extra.
Hi I tried this, its not working. Also now i have changed the template file name to extra1.html but still no success,
Thanks
Views
Replies
Total Likes
This works perfectly with me...
<div data-sly-use.extra="extra1.html">
<div data-sly-call="${extra.extra @ text='hello'}"></div>
</div>
extra1.html:
<template data-sly-template.extra="${@ text}">
<p>hello from template</p>
</template>
Can you first try this?
Views
Replies
Total Likes
Feike Visser wrote...
This works perfectly with me...
<div data-sly-use.extra="extra1.html">
<div data-sly-call="${extra.extra @ text='hello'}"></div>
</div>
extra1.html:
<template data-sly-template.extra="${@ text}">
<p>hello from template</p>
</template>
Can you first try this?
Yes, This works, But the issue was in the invocation of ExtraHelper class.
<template data-sly-template.extra="${@ text}" data-sly-use.extraHelper="${'ExtraHelper' @ text=text}"> <p>${extraHelper.reversedText}</p> </template>
which is still there, Its not initializing extraHelper with the text 'hello' that we are passing above, the output should come as olleh. But nothing shows as output. Even when i write System.out.println(":::::"); its doesn't write anything to stdout.log.
Thanks
Views
Replies
Total Likes
Ok, now we are getting somewhere :-)
What is the path of your component?
Views
Replies
Total Likes
Feike Visser wrote...
Ok, now we are getting somewhere :-)
What is the path of your component?
This is component path : /apps/AEMProject/components/content/SightlyTest
Views
Replies
Total Likes
Can you change this to all lowercase, and then also change the package of your Java-class to all lowercase?
To me this is likely the cause...
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies