この会話は、活動がないためロックされています。新しい投稿を作成してください。
この会話は、活動がないためロックされています。新しい投稿を作成してください。
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.
解決済! 解決策の投稿を見る。
表示
返信
いいね!の合計
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...
表示
返信
いいね!の合計
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.
表示
返信
いいね!の合計
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
表示
返信
いいね!の合計
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?
表示
返信
いいね!の合計
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
表示
返信
いいね!の合計
Ok, now we are getting somewhere :-)
What is the path of your component?
表示
返信
いいね!の合計
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
表示
返信
いいね!の合計
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...
表示
返信
いいね!の合計