I have a problem with the inter-portlet-communication in Liferay. Two portlets are communicating through Events.
Sender:
<supported-publishing-event xmlns:x='http://liferay.com'>
<qname>x:aufgabeInfo</qname>
</supported-publishing-event>
Listener:
<supported-processing-event xmlns:x='http://liferay.com'>
<qname>x:aufgabeInfo</qname>
</supported-processing-event>
Event:
<event-definition xmlns:x='http://liferay.com'>
<qname>x:aufgabeInfo</qname>
<value-type>java.lang.String</value-type>
</event-definition>
Sender-Portlet:
<a onclick="selectedEntry('${aufgabe.aufgabenName}', '${aufgabe.aufgabenID}');">
${aufgabe.aufgabenName} </a><br/>
The onclick-event calls a ProcessAction-method via ajax call.
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");
},
});
And the ProcessAction-method setting a Event for Commincation.
QName qName = new QName("http://liferay.com", "aufgabeInfo", "x");
actionResponse.setEvent(qName, jsonString);
So the Listener-Portlet receives this event in the ProcessEvent-method.
Event event = request.getEvent();
String jsonString = (String) event.getValue();
My Problem is that i need the jsonString in javascript. With an onclick-Event it doesn't refresh the whole page, but the communication works. With an button it refresh the whole page, but the communication doesn't works.
Any idea?