留言板
Add portlet in jsp
Hello,
can someone give me hint or link with explanation how to add portlet to jsp page?
Something like $theme.runtime in vm-template.
10x in advance.
can someone give me hint or link with explanation how to add portlet to jsp page?
Something like $theme.runtime in vm-template.
10x in advance.
Thank You.
But by just adding <runtime-portlet name="..."/> tag in the view.jsp of my portlet will not work. Maybe I'll need to add some taglib for runtime?
But by just adding <runtime-portlet name="..."/> tag in the view.jsp of my portlet will not work. Maybe I'll need to add some taglib for runtime?
...or it will be better to add my portlet in Liferay ROOT?
OK, I'll ask this again, since I cannot solve this "simple" problem for several days:
I want to create a simple (one jsp page) portlet, that will contain other portlets (from Liferay core).
I thought the tag <liferay-portlet:runtime portletName="..." /> will do the job, but this throws exception:
java.lang.NoClassDefFoundError: com/liferay/portlet/layoutconfiguration/util/RuntimePortletUtil
As far as I understand, the portlet cannot access portal-impl.jar (that contains RuntimePortletUtil).
Can someone show me a simple solution to this?
10x in advance.
I want to create a simple (one jsp page) portlet, that will contain other portlets (from Liferay core).
I thought the tag <liferay-portlet:runtime portletName="..." /> will do the job, but this throws exception:
java.lang.NoClassDefFoundError: com/liferay/portlet/layoutconfiguration/util/RuntimePortletUtil
As far as I understand, the portlet cannot access portal-impl.jar (that contains RuntimePortletUtil).
Can someone show me a simple solution to this?
10x in advance.
Hi,
the <liferay-portlet:runtime> tag does not work for me in a JSP page, as you already mentionned, because the library liferay-portlet is not in the classpath of the JSP portlet.
A workaround I found is to use <liferay-ui:.../> tag, like that :
This will display a calendar.
There are lots of other methods in that taglib, like <liferay-ui:journal-article ...> to display a specific content in your jsp, for example.
Hopes that help you.
Regards,
Cédric
the <liferay-portlet:runtime> tag does not work for me in a JSP page, as you already mentionned, because the library liferay-portlet is not in the classpath of the JSP portlet.
A workaround I found is to use <liferay-ui:.../> tag, like that :
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
<div id="calendar">
<liferay-ui:calendar day="" year="" month="" />
</div>
This will display a calendar.
There are lots of other methods in that taglib, like <liferay-ui:journal-article ...> to display a specific content in your jsp, for example.
Hopes that help you.
Regards,
Cédric
gofri _:
Thank You.
Maybe I'll need to add some taglib for runtime?
You'll need to add the liferay-portlet-ext.tld tag library, which provides a "runtime" element.
I add in my portlet web.xml taglib like
And in my jsp I have :
But i got error
Anybody have idea how to fixed it?
Regards
Darek
<taglib>
<taglib-uri>http://liferay.com/tld/portlet_ext_test</taglib-uri>
<taglib-location>/WEB-INF/tld/liferay-portlet-ext.tld</taglib-location>
</taglib>
And in my jsp I have :
..
<%@ taglib uri="http://liferay.com/tld/ext-test" prefix="ext-test" %>
..
<ext-test:runtime portletname="47" querystring=""></ext-test:runtime>
But i got error
[PortletRequestDispatcherImpl:108] org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: com/liferay/portlet/layoutconfiguration/util/RuntimePortletUtil
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: com/liferay/portlet/layoutconfiguration/util/RuntimePortletUtil
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:527)
....
Anybody have idea how to fixed it?
Regards
Darek
The tag liferay-portlet-ext:runtime only can be used in EXT enviroment. This tag needs portal-impl.jar that it isn't in WEB-INF/lib. In a staff member words, NEVER put portal-impl.jar inside your plugin.
I tried all the solutions available.. But no luck...
Can someone provide a example of how to include a portlet in a jsp file. This would be a great help.
Thanks
Can someone provide a example of how to include a portlet in a jsp file. This would be a great help.
Thanks
This way you cn create a link in jsp given below and invoke an instance of portlet.You need to put yourt portlets id instaed of 146 as given below:
<%
ThemeDisplay themeDisplay1 = (ThemeDisplay)request.getAttribute(com.liferay.portal.kernel.util.WebKeys.THEME_DISPLAY);
Layout layout1 = themeDisplay1.getLayout();
long plid1 = layout1.getPlid() ;
PortletURL ipcURL = new PortletURLImpl(request, "146", plid1, PortletRequest.ACTION_PHASE);
ipcURL.setWindowState(WindowState.MAXIMIZED);
%>
<br/>
<a href="<%=ipcURL.toString()%>">Page Template Portlet</a>
<%
ThemeDisplay themeDisplay1 = (ThemeDisplay)request.getAttribute(com.liferay.portal.kernel.util.WebKeys.THEME_DISPLAY);
Layout layout1 = themeDisplay1.getLayout();
long plid1 = layout1.getPlid() ;
PortletURL ipcURL = new PortletURLImpl(request, "146", plid1, PortletRequest.ACTION_PHASE);
ipcURL.setWindowState(WindowState.MAXIMIZED);
%>
<br/>
<a href="<%=ipcURL.toString()%>">Page Template Portlet</a>
Rajesh,
Thanks for the quick reply... I tried pasting the code in my jsp file and I see this
error:
themes Display cannot be resolved to a type
I did include the the following..
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
<%@ page import="com.liferay.portal.kernel.util.WebKeys" %>
<%@ page import="javax.portlet.PortletPreferences" %>
<%@ page import="javax.portlet.PortletURL" %>
<%@ page import="javax.portlet.ResourceURL" %>
<%@ page import="javax.portlet.WindowState" %>
<%@ page import="com.liferay.portal.kernel.util.ParamUtil" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@page import="com.liferay.portal.kernel.util.ParamUtil" %>
<liferay-theme:defineObjects />
Do you think I am missing something else..
Thanks
Thanks for the quick reply... I tried pasting the code in my jsp file and I see this
error:
themes Display cannot be resolved to a type
I did include the the following..
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
<%@ page import="com.liferay.portal.kernel.util.WebKeys" %>
<%@ page import="javax.portlet.PortletPreferences" %>
<%@ page import="javax.portlet.PortletURL" %>
<%@ page import="javax.portlet.ResourceURL" %>
<%@ page import="javax.portlet.WindowState" %>
<%@ page import="com.liferay.portal.kernel.util.ParamUtil" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@page import="com.liferay.portal.kernel.util.ParamUtil" %>
<liferay-theme:defineObjects />
Do you think I am missing something else..
Thanks