Liferay のポートレット間通信に問題があります。2 つのポートレットがイベントを通じて通信しています。
送信者:
<supported-publishing-event xmlns:x='http://liferay.com'>
<qname>x:aufgabeInfo</qname>
</supported-publishing-event>
リスナー:
<supported-processing-event xmlns:x='http://liferay.com'>
<qname>x:aufgabeInfo</qname>
</supported-processing-event>
イベント:
<event-definition xmlns:x='http://liferay.com'>
<qname>x:aufgabeInfo</qname>
<value-type>java.lang.String</value-type>
</event-definition>
送信者ポートレット:
<a onclick="selectedEntry('${aufgabe.aufgabenName}', '${aufgabe.aufgabenID}');">
${aufgabe.aufgabenName} </a><br/>
onclick-event は、ajax 呼び出しを介して ProcessAction メソッドを呼び出します。
function selectedEntry(name, id){
console.log("in click");
var url = '<portlet:actionURL name="open"/>';
$.ajax({
type: "POST",
url: url,
data: {"name": name, "ID": id},
dataType: "json",
success: function(){
console.log("in success");
},
});
そして、Commincation のイベントを設定する ProcessAction メソッド。
QName qName = new QName("http://liferay.com", "aufgabeInfo", "x");
actionResponse.setEvent(qName, jsonString);
したがって、Listener-Portlet は ProcessEvent メソッドでこのイベントを受け取ります。
Event event = request.getEvent();
String jsonString = (String) event.getValue();
私の問題は、javascript で jsonString が必要なことです。onclick-Event を使用すると、ページ全体が更新されませんが、通信は機能します。ボタンでページ全体を更新しますが、通信は機能しません。
何か案が?