【问题标题】:How to get design dialog properties in Sling model?如何在 Sling 模型中获取设计对话框属性?
【发布时间】:2016-07-13 09:43:54
【问题描述】:

我有一个设计对话框,其中的值存储在 etc/design// 中。但是现在我应该如何在 Sling 模型中读取这些属性?

【问题讨论】:

    标签: aem sling-models


    【解决方案1】:

    你可以使用脚本绑定来获取 currentStyle -

    @Inject @Source("script-bindings")
    private Style currentStyle
    

    然后使用 -

    currentStyle.get("<name of the text field>",String.class)
    

    【讨论】:

      【解决方案2】:

      您可以注入ResourceResolverFactory,然后获取ResourceResolver,然后获取您需要的任何属性。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-06-13
        • 1970-01-01
        • 2014-05-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多