留言板

Add portlet in jsp

gofri _,修改在13 年前。

Add portlet in jsp

Junior Member 帖子: 92 加入日期: 07-3-2 最近的帖子
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.
Ramesh Vijayaraghavan,修改在13 年前。

RE: Add portlet in jsp

Junior Member 帖子: 49 加入日期: 10-9-15 最近的帖子
Check this link...probably, this is what you are looking for.
gofri _,修改在13 年前。

RE: Add portlet in jsp

Junior Member 帖子: 92 加入日期: 07-3-2 最近的帖子
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?
gofri _,修改在13 年前。

RE: Add portlet in jsp

Junior Member 帖子: 92 加入日期: 07-3-2 最近的帖子
...or it will be better to add my portlet in Liferay ROOT?
gofri _,修改在13 年前。

RE: Add portlet in jsp

Junior Member 帖子: 92 加入日期: 07-3-2 最近的帖子
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.
thumbnail
Cédric Briançon,修改在13 年前。

RE: Add portlet in jsp

New Member 帖子: 17 加入日期: 10-10-28 最近的帖子
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 :

&lt;%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %&gt;

<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 _,修改在13 年前。

RE: Add portlet in jsp

Junior Member 帖子: 92 加入日期: 07-3-2 最近的帖子
Thank You!
thumbnail
Minhchau Dang,修改在13 年前。

RE: Add portlet in jsp

Liferay Master 帖子: 598 加入日期: 07-10-22 最近的帖子
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.
Dariusz Sawicki,修改在12 年前。

RE: Add portlet in jsp

Regular Member 帖子: 165 加入日期: 09-3-27 最近的帖子
I add in my portlet web.xml taglib like


<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 :


..
&lt;%@ taglib uri="http://liferay.com/tld/ext-test" prefix="ext-test" %&gt;
..
<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
Vanesa Peña,修改在12 年前。

RE: Add portlet in jsp

New Member 发布: 1 加入日期: 11-5-26 最近的帖子
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.
thumbnail
Ram Manusani,修改在12 年前。

RE: Add portlet in jsp

Regular Member 帖子: 124 加入日期: 11-10-27 最近的帖子
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
thumbnail
Rajesh Chaurasia,修改在12 年前。

RE: Add portlet in jsp

Regular Member 帖子: 183 加入日期: 11-8-18 最近的帖子
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>
thumbnail
Ram Manusani,修改在12 年前。

RE: Add portlet in jsp

Regular Member 帖子: 124 加入日期: 11-10-27 最近的帖子
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
thumbnail
Rajesh Chaurasia,修改在12 年前。

RE: Add portlet in jsp

Regular Member 帖子: 183 加入日期: 11-8-18 最近的帖子
You need to import in ur jsp ,the ThemeDisplay class.