我有两个具有以下操作方法的portlet
A-Portlet
public void actionMethodA(ActionRequest actionRequest,
ActionResponse actionResponse) throws IOException, PortletException {
System.out.println("Portlet A");
}
B-Portlet
public void actionMethodB(ActionRequest actionRequest,
ActionResponse actionResponse) throws IOException, PortletException {
System.out.println("Portlet B");
}
我们可以在B-Portlet中调用actionMethodB吗?
答案 0 :(得分:0)
使用PortletClassInvoker
类从另一个插件调用插件方法。
示例:
try {
methodKey = new MethodKey(
ClassResolverUtil.resolveByPortletClassLoader(
"com.acme.SyncFactoryRegistry",
"custom-portlet"), "register", String.class,
Object.class);
}
catch (RuntimeException re) {
return;
}
PortletClassInvoker.invoke(
false, "1_WAR_customportlet",
_methodKey , arg1, arg2);