如何在AEM中检查子组件资源是否存在或未正常使用?

如何在AEM中检查子组件资源是否存在或未正常使用?,aem,sightly,Aem,Sightly,我的组件中有一个嵌入的图像组件,我只需要在编写图像组件时显示图像 组件代码: <div class="rightSideTile tile-img col-xs-5 col-md-4"> <sly data-sly-resource="${'image' @ resourceType='test/components/content/image'}"></sly> </div> 所以,我需要检查是否编写了嵌入式图像组件的资源 我知道我们可以在

我的组件中有一个嵌入的图像组件,我只需要在编写图像组件时显示图像

组件代码:

<div class="rightSideTile tile-img col-xs-5 col-md-4">
<sly data-sly-resource="${'image' @ resourceType='test/components/content/image'}"></sly>
</div>

所以,我需要检查是否编写了嵌入式图像组件的资源


我知道我们可以在Java中实现这一点,但如何在Sightly中实现这一点呢?

这是可行的,使用${resource['image/jcr:primaryType']}

这里的图像是子组件

<sly data-sly-test="${resource['image/jcr:primaryType']}">
<div class="col-xs-5 col-md-4">
<sly data-sly-resource="${'image' @ resourceType='test/components/content/image'}"></sly>
</div>
</sly>