掲示板
method setEvent(QName, String) is undefined for the type ResourceResponse
11年前 に Ram Dev によって更新されました。
method setEvent(QName, String) is undefined for the type ResourceResponse
Junior Member 投稿: 46 参加年月日: 11/06/29 最新の投稿
Hi
I am using Liferay 6.1 Version .
Here i am trying to Implement Inter Portlet Communication .
When I am calling Ajax function to resource server method its getting all data ,
in that method but when everything is done , i want to show that response in my Another Portlet
Here this is what i tried till now .
Here is my view.jsp which makes an Ajax call
Here is i made changes to portlet.xml file
This is my serveResource Method
But i am getting a Compiletime error saying that
The method setEvent(QName, String) is undefined for the type ResourceResponse
Please help me in how to implement IPC using Events in my case .
I am using Liferay 6.1 Version .
Here i am trying to Implement Inter Portlet Communication .
When I am calling Ajax function to resource server method its getting all data ,
in that method but when everything is done , i want to show that response in my Another Portlet
Here this is what i tried till now .
Here is my view.jsp which makes an Ajax call
function addToDo(addToDo){
var todo =document.getElementById('toDo').value;
$.ajax({
url :addToDo,
data: {"todo":todo,"CMD":"addToDo"},
type: "GET",
dataType: "text",
success: function(data) {
alert(data);
}
});
}
Here is i made changes to portlet.xml file
<portlet>
<supported-publishing-event xmlns:x="http://liferay.com">
<qname>x:empinfo</qname>
</supported-publishing-event>
</portlet>
<event-definition xmlns:x="http://liferay.com">
<qname>x:empinfo</qname>
<value-type>java.lang.String</value-type>
</event-definition>
This is my serveResource Method
public class AjaxPortletTest extends MVCPortlet {
@Override
public void serveResource(ResourceRequest request, ResourceResponse response) throws IOException{
javax.xml.namespace.QName qName = new QName("http://liferay.com", "empinfo", "x");
// In the below line i am getting Compiletime Error .
response.setEvent(qName, "Hi! You have received Event Data sent from Sender Portlet");
}
}
But i am getting a Compiletime error saying that
The method setEvent(QName, String) is undefined for the type ResourceResponse
Please help me in how to implement IPC using Events in my case .