我有两个portlet,我正在尝试从portletA发送一个事件到portletB。现在的问题是,当我将两个端口保持在同一页面中时,它可以正常工作但是当我将它们保存在不同的页面中时,PortletB的view.jsp页面即使控制进入portletB的方法ProcessAction也不会刷新(值我是priting得到印刷,所以我猜控制来到那个部分。)
Portlet A. view.jsp的
TMB::compile
Java方法:
<portlet:actionURL var="changedb" name="processEvent"/>
<aui:form method="post" action="<%=changedb.toString() %>">
<aui:fieldset>
<aui:select label="Select Bot" id="options" name="botname"
required="true" showEmptyOption="true">
<aui:option value="otion1" name="option1"
>option1</aui:option>
<aui:option value="option2" name="option2"
>option2</aui:option>
</aui:select>
<aui:button type="submit" value="Send"/>
</aui:fieldset>
</aui:form>
Portlet B(接收方)
@ProcessAction(name="processEvent")
public void process(ActionRequest request, ActionResponse response) {
String bot = ParamUtil.getString(request, "botname","");
String url = "somehttplink" + bot;
System.out.print("control came inside changedbportlet");
System.out.println(url);
QName qName = new QName("botchange");
response.setEvent(qName, url);
}
Java方法:
<portlet:defineObjects />
<%
String url = (String) renderRequest.getParameter("url");
%>
<main class="container">
<div class="row">
<div class="col-lg-12">
<div id="initial-screen">
<iframe class="iframe" src="<%= url %>" width = "1000" height="800"
></iframe>
</div>
</div>
</div>
</main>
我正在使用Liferay 7和osgi模块。我还根据https://web.liferay.com/community/wiki/-/wiki/Main/portlet+to+portlet+communication中的说明在portlet-ext.properties文件中添加了以下命令。
@ProcessEvent(qname = "botchange")
public void myEvent(EventRequest request, EventResponse response)
throws javax.portlet.PortletException,
java.io.IOException {
Event event = request.getEvent();
String url = (String) event.getValue();
System.out.println("control came to showpageportlet");
System.out.print(url);
response.setRenderParameter("url", url);
}
我做错了什么?