我希望在我的小部件的监听器下的CQ5中的对话参与者步骤中获得有效负载。下面是我的对话框。
<?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:Dialog" title="Changetemplate" xtype="dialog">
<items jcr:primaryType="cq:WidgetCollection">
<Template jcr:primaryType="cq:Panel">
<items jcr:primaryType="cq:WidgetCollection">
<Path jcr:primaryType="cq:Widget" fieldLabel="Select Template" id="mytemplate" name="./jcr:content/templatepath" xtype="textfield">
<listeners jcr:primaryType="nt:unstructured" afterrender="function(component){ var dialog = CQ.wcm.showTemplate('/content/geometrixx/en'); dialog.show(); }" />
</Path>
</items>
</Template>
</items>
</jcr:root>
由于
答案 0 :(得分:1)
这可以通过java中的以下代码来完成。
public class MyParticipant implements ParticipantStepChooser {
@Property(value = "An example.")
static final String DESCRIPTION = Constants.SERVICE_DESCRIPTION;
@Property(value = "MyComapany")
static final String VENDOR = Constants.SERVICE_VENDOR;
@Property(value = " Participant Chooser Process")
static final String LABEL=ParticipantStepChooser.SERVICE_PROPERTY_LABEL;
private static final String TYPE_JCR_PATH = "JCR_PATH";
public String getParticipant(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap args) throws WorkflowException {
WorkflowData workflowData = workItem.getWorkflowData();
if (workflowData.getPayloadType().equals(TYPE_JCR_PATH)) {
String path = workflowData.getPayload().toString();
}
return "";
}
}
在ecma脚本中
var workflowData = graniteWorkItem.getWorkflowData();
if (workflowData.getPayloadType() == "JCR_PATH") {
var path = workflowData.getPayload().toString(); }
但是如果你想在对话框中专门尝试获取该路径
1. CQ.utils.WCM.getPagePath();
如果以上解决方案无法解决您的问题,那么