我有两个Portlet,正在尝试将一个事件从say portletA发送到portletB。现在的问题是,当我将两个端口保持在同一个页面中时,它可以工作,但当我将它们保持在不同的页面中时,视图。即使控件指向PortletB的方法ProcessAction,PortletB的jsp页面也不会刷新(我要打印的值会打印出来,所以我猜控件指向该部分)。
Portlet A
看法jsp
<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>
Java方法:
@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);
}
Portlet B(接收器)
<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>
Java方法:
@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);
}
我正在使用Liferay 7和osgi模块。我还按照中的说明在portlet-ext.properties文件中添加了以下命令
https://web.liferay.com/community/wiki/-/wiki/Main/portlet+to+portlet+communication
.
portlet.event.distribution=layout-set
我做错了什么?