Fórum

Embedding portlets in a layout template

thumbnail
Sushil Kumar Saini, modificado 11 Anos atrás.

Embedding portlets in a layout template

Regular Member Postagens: 104 Data de Entrada: 27/07/11 Postagens Recentes
I have tried to embed the portlet in a layout template. Following the instructions given in the "Liferay Portal 6.1 - Development Guide". And facing the problem that my portlet is not getting embedded.

While debugging, found there is problem with the following method.
$processor.processPortlet("3")

It seems there is a bug in processPortlet(String portletId) method of TemplateProcessor.java file of liferay portal. If i am using the following method of "theme" object as given in the wiki . It is working fine.
$theme.runtime($myPortletId, $queryString, $velocityPortletPreferences.toString())

Have anyone tried $processor.processPortlet("3") method for embedding the portlet in the layout template?
thumbnail
Rahul Pande, modificado 11 Anos atrás.

RE: Embedding portlets in a layout template

Expert Postagens: 310 Data de Entrada: 07/07/10 Postagens Recentes
Hi Sushil,

There seems to be issue with Liferay. I found some defects logged in JIRA

Issue

I am also facing this issue. Please let me know if you find some solution for this


Thanks
Rahul
thumbnail
Sushil Kumar Saini, modificado 11 Anos atrás.

RE: Embedding portlets in a layout template

Regular Member Postagens: 104 Data de Entrada: 27/07/11 Postagens Recentes
Hi Rahul,

I have tried the following method for embedding the theme in layout and it is working fine.
theme.runtime("3", "", "");

If you want to use the processer.processPortlet("3") method. Fix in the java code of liferay portal source code would be required. Find the sample code given below.

public class TemplateProcessor implements ColumnProcessor {
................................
...............................
public String processPortlet(String portletId) throws Exception {
try {
_request.setAttribute(
WebKeys.RENDER_PORTLET_RESOURCE, Boolean.TRUE);
// Fix for embed portlet in layout
_portletId = portletId;
return RuntimePortletUtil.processPortlet(
_servletContext, _request, _response, null, null, _portletId,
null, false);
}
finally {
_request.removeAttribute(WebKeys.RENDER_PORTLET_RESOURCE);
}
}
................................
...............................
}