从AEM中的触摸UI下拉获取文本和值
问题描述:
我有一个静态的下拉列表,但我想从AEM触摸UI中的下拉列表中获取值和文本。从AEM中的触摸UI下拉获取文本和值
<articleType
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/select"
fieldLabel="Article Type"
name="./articleType">
<items jcr:primaryType="nt:unstructured">
<select
jcr:primaryType="nt:unstructured"
text="Select Icon"
value=""/>
<article
jcr:primaryType="nt:unstructured"
text="Article"
value="article"/>
<video
jcr:primaryType="nt:unstructured"
text="Video"
value="video"/>
<infographic
jcr:primaryType="nt:unstructured"
text="Infographic"
value="graph"/>
</items>
</articleType>
现在我想取它像<i class="article-icon icon" />
。我可以从“值”中获取“图标类”,但我需要总是有一些测试条件来获取文本。 所以我想要一个解决方案。
答
我已经使用这种需求的数据源。在下面列出的例子中,使用了一个jsp文件。您可以很好地创建WCMUsePojo类并在HTML中调用它来引用动态文本和值对。
请检查:
https://helpx.adobe.com/experience-manager/using/creating-granite-datasource.html
为什么不只是做一个什么样的中值和文本的复合价值?无论如何,它们都是静态的,对吧?或者从后端代码中的值中推断出文本?什么是确切的用例? – toniedzwiedz
我不想做任何手术,所以构图不适合我。 –