我正在尝试 [a link] http://docs.adobe.com/docs/en/aem/6-0/develop/sightly/use-api-in-java.html给出的示例示例。我创建了组件 SightlyTest,其中对模板的 data-sly-call 不起作用。以下是我在组件中的文件: extra.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 reversedText;
public String getReversedText() {
return reversedText;
}
@Override
public void activate() throws Exception {
String text = get("text", String.class);
reversedText = new StringBuilder(text).reverse().toString();
System.out.print("reversedText ::: "+reversedText);
}
}
SightlyOp.java
package apps.AEMProject.components.content.SightlyTest;
import com.adobe.cq.sightly.WCMUse;
public class SightlyOp extends WCMUse {
private String lowerCaseTitle;
private String lowerCaseDescription;
@Override
public void activate() throws Exception {
lowerCaseTitle = getProperties().get("title", "").toLowerCase();
lowerCaseDescription = getProperties().get("description", "").toLowerCase();
}
public String getLowerCaseTitle() {
return lowerCaseTitle;
}
public String getLowerCaseDescription() {
return lowerCaseDescription;
}
}
SightlyTest.html
<div data-sly-use.sg="SightlyOp"
data-sly-use.extra="extra.html">
<h1>${sg.lowerCaseTitle}</h1>
<p>${sg.lowerCaseDescription}</p>
<div data-sly-call="${extra @ text=properties.description}"></div>
</div>
sg.lowerCaseTitle 和 sg.lowerCaseDescription 工作正常,但数据狡猾呼叫没有显示谢谢