2014-09-12 5 views
1

Я имею два портлета со следующими методами действийпортлетов Использование других портлетов

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"); 
} 

Можем ли мы назвать actionMethodB в B-портлета?

+0

Что вы имеете в виду, называя actionMethodB в B-портлет? Когда ваш action-url будет иметь параметр действия как actionMethodB, он будет вызван. –

+0

Ответил здесь: http://stackoverflow.com/questions/33276042/display-liferay-portlet-inside-other-liferay-portlet и http://stackoverflow.com/questions/23134708/open-portlet-from-other- портлет – greenmarker

ответ

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);