HTL Sightly,用于传递参数和指定捆绑

时间:2019-06-14 18:38:01

标签: sightly aem-6 htl

是否可以使用HTL Sightly Use API将变量传递给data-sly-use语句,同时还要指定捆绑包? 例如

<sly data-sly-use.help="${'com.company.service.Helper' @ myVar='hello!'}"></sly>

与助手

package com.company.service;

import com.adobe.cq.sightly.WCMUsePojo;

public class Helper extends WCMUsePojo {

    @Override
    public void activate() throws Exception {
        String myVar = getProperties().get("myVar", String.class);
        // why is myVar is null?
    }
}

如果有所不同,则在AEM 6.4.3.0中

1 个答案:

答案 0 :(得分:0)

扩展select s.* from summary s where not exists ( select 1 from summary where repcode = s.repcode and lastupdatedate > s.lastupdatedate ) 时,您需要使用WCMUsePojohttps://helpx.adobe.com/experience-manager/6-2/sites/developing/using/reference-materials/javadoc/com/adobe/cq/sightly/WCMUsePojo.html#get(java.lang.String,%20java.lang.Class))方法才能获取作为表达式选项传递的对象。

还可以查看https://docs.adobe.com/content/help/en/experience-manager-htl/using/htl/use-api-java.html

中的传递参数部分