java - Inter-Portlet-Communication - Liferay -
i have problem inter-portlet-communication in liferay. 2 portlets 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 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 processaction-method setting event commincation.
qname qname = new qname("http://liferay.com", "aufgabeinfo", "x"); actionresponse.setevent(qname, jsonstring);
so listener-portlet receives event in processevent-method.
event event = request.getevent(); string jsonstring = (string) event.getvalue();
my problem need jsonstring in javascript. onclick-event doesn't refresh whole page, communication works. button refresh whole page, communication doesn't works.
any idea?
the first version of portlet specification, jsr-168/portlet1.0, did not include support inter portlet communication. second version, jsr-286/ portlet2.0, supported ipc mechanism. ipc made easy jsr-286 share data between 2 portlets. using ipc mechanisms, can share data action view phase , view-view phase.
for step-by step guideline creating portlet in liferay, can read here
Comments
Post a Comment