Osgi 如何将cq:listener添加到组件
我正在尝试将Osgi 如何将cq:listener添加到组件,osgi,aem,Osgi,Aem,我正在尝试将cq:listener添加到我的组件中,以便在选择资产并单击“确定”后,页面刷新 这是组件在屏幕上的外观,我在屏幕上选择一个资产并单击ok 在我的代码中,dialog.xml如下所示 <?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:prima
cq:listener
添加到我的组件中,以便在选择资产并单击“确定”后,页面刷新
这是组件在屏幕上的外观,我在屏幕上选择一个资产并单击ok
在我的代码中,dialog.xml
如下所示
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:Dialog"
xtype="dialog">
<items
jcr:primaryType="cq:Widget"
xtype="tabpanel">
<items jcr:primaryType="cq:WidgetCollection">
<tab1
jcr:primaryType="cq:Panel"
title="Tab">
<items
jcr:primaryType="cq:WidgetCollection">
<asset-reference
jcr:primaryType="cq:Widget"
fieldLabel="Foo Bar:"
fieldDescription="Select the asset under /content/dam/foo-sync"
name="./fileReference"
xtype="pathfield"
rootPath="/content/dam/evernote-sync"/>
</items>
</tab1>
</items>
</items>
</jcr:root>
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:EditConfig">
<cq:dropTargets jcr:primaryType="nt:unstructured">
<fileReference
jcr:primaryType="cq:DropTargetConfig"
accept="[text/.*]"
groups="[media]"
propertyName="./fileReference"/>
</cq:dropTargets>
</jcr:root>
创建一个名为
cq:listeners
的节点,并键入cq:EditListenersConfig
作为cq:EditConfig
节点的子节点。将属性afteredit
添加到新创建的具有值REFRESH\u PAGE
的节点,以在编辑组件后刷新页面。默认情况下,此值为REFRESH\u SELF
,因此编辑后只刷新组件,而不刷新整个页面
\u cq\u editConfig.xml
看起来像这样
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:EditConfig">
<cq:listeners jcr:primaryType="cq:EditListenersConfig"
afteredit="REFRESH_PAGE"/>
<cq:dropTargets jcr:primaryType="nt:unstructured">
<fileReference
jcr:primaryType="cq:DropTargetConfig"
accept="[text/.*]"
groups="[media]"
propertyName="./fileReference"/>
</cq:dropTargets>
</jcr:root>
更多详细信息可以在中找到。您可以在_cq\u editConfig.xml中尝试以下内容