0
votes

I'm trying to render a layout template with nested portlets inside my custom Liferay portlet. Liferay's own "Nested Portlets" portlet does it using the RuntimePortletUtil in view.jsp:

RuntimePortletUtil.processTemplate(application, request, response, pageContext, out, velocityTemplateId, velocityTemplateContent);

When I do the same in my portlet however, I get the following error as soon as I put any portlets inside the layout template:

[render_portlet_jsp:157] javax.servlet.ServletException: File "/html/portal/render_portlet.jsp" not found
at org.apache.jasper.servlet.JspServlet.handleMissingResource(JspServlet.java:412)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:379)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

Can RuntimePortletUtil only be used in the Liferay portlet context or is there a way to get this working in my own portlet?

1
which liferay version you tried ? 6.1 or 6.2 ? Are you using above call inside JSP ? How did you get velocityTemplateId & velocityTemplateContent ?Haris

1 Answers

0
votes

It looks like the implementation requires a file /html/portal/render_portlet.jsp which you might not have. It might be as simple as checking that file, see if you only need it or a few more resources.

However, instead of hunting that implementation down, I'd recommend looking at the underlying problem that you'd like to solve: IMHO Layout Templates are by far the easiest plugin types you can have in Liferay. All the examples I've seen for nesting Layout Templates looked more like a quick hack than like a proper solution. My recommendation is to provide some custom layout templates: It typically won't be a huge number of them, as increased numbers of layouts are typically increasingly confusing to the end user.

NestedPortlet is implemented inside Liferay's core and does not make any assumptions about running outside. While it might not be the best architectural decision to implement it depending on the server, nobody paid attention to make that code able to run outside of the portal - do yourself a favor and make your life easier by checking a different solution.