Foren

How to imped portlet inside jsf portlet ?

Hebatu Allah Fahmy, geändert vor 11 Jahren.

How to imped portlet inside jsf portlet ?

Junior Member Beiträge: 41 Beitrittsdatum: 06.08.12 Neueste Beiträge
Please , How can we imped portlet (e.g web content ) inside JSF portlet ?

Any help will be appreciated

Thanks in Advance
thumbnail
Dominik domih, geändert vor 11 Jahren.

RE: How to imped portlet inside jsf portlet ?

Junior Member Beiträge: 57 Beitrittsdatum: 10.11.08 Neueste Beiträge
A possible solution could be to add a portlet widget to your portlet. This lets you show a portlet without the portal around it. See the iframe portlet code for details...
thumbnail
Neil Griffin, geändert vor 11 Jahren.

RE: How to imped portlet inside jsf portlet ?

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
Another solution would be to use the Liferay Service Layer API in order to retrieve the web content article, and then use a JSF view to display the results. For more information, see related forum post.
Hebatu Allah Fahmy, geändert vor 11 Jahren.

RE: How to imped portlet inside jsf portlet ?

Junior Member Beiträge: 41 Beitrittsdatum: 06.08.12 Neueste Beiträge
Many Thanks Neil

Actually I don't want the content , I want to embed the portlet it self (asset Publisher ) to make use of its configuration that liferay provides instead of re-programmatic it from the beginning .
e.g I want to to get contents belongs to certain category or more than category , I want to change its template easy in any time
By getting the content only in my plugin portlet I am forced to re-write code to achieve that and of course it will not provide the dynamic in configuration like asset publisher provides .

so I was thinking and asking if there is a way to include the instance portlet of asset publisher itself in my portlet ?


I have write the following and when user clicks on link it renders on asset publisher portlet , but I don't know how to make the asset publisher appears without user click

<%
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, "101", plid1, PortletRequest.ACTION_PHASE);*/

PortletURL ipcURL = PortletURLFactoryUtil.create(request, "101", plid1, "ACTION_PHASE");


ipcURL.setWindowState(WindowState.MAXIMIZED);
%>
<br/>
<a href="<%=ipcURL.toString()%>">Page Template Portlet</a>


any help will be appreciated

Thanks in advance
thumbnail
Neil Griffin, geändert vor 11 Jahren.

RE: How to imped portlet inside jsf portlet ?

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
Along the lines of what Dominik suggested, you could try using the following in a simple JSP portlet:

<liferay-portlet:runtime portletName="<%= portletId %>" />


There is no Facelets equivalent yet, but the tag *might* work in a JSF2 portlet that uses JSP as the view declaration language, rather than Facelets.
Hebatu Allah Fahmy, geändert vor 11 Jahren.

RE: How to imped portlet inside jsf portlet ?

Junior Member Beiträge: 41 Beitrittsdatum: 06.08.12 Neueste Beiträge
I have tried it

with portlet Id
portlet_101_INSTANCE_XaF30gFyQsyD

or portletId
101


both of them gives the following exception
An error occurred while accessing the requested resource.

http://localhost:8080/web/guest/home?p_p_id=58&p_p_lifecycle=0&p_p_state=normal&p_p_state_rcv=1&_58_struts_action=%2Flogin%2Flogin

is there is a way get portlet Id ?
thumbnail
Neil Griffin, geändert vor 11 Jahren.

RE: How to imped portlet inside jsf portlet ?

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
OK I just tried it in a few different ways:

1) Liferay 6.0.6 - Result - DOESN'T WORK emoticon

Here is the error I get:

Caused by: java.lang.ClassNotFoundException: com.liferay.portlet.layoutconfiguration.util.RuntimePortletUtil
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
	at com.liferay.taglib.portletext.RuntimeTag.doTag(RuntimeTag.java:108)
	at com.liferay.taglib.portletext.RuntimeTag.doEndTag(RuntimeTag.java:135)


This indicates that the liferay-portlet:runtime JSP tag can only be used in the ROOT context where Liferay's out-of-the-box portlets live, and not in a different context, such as a hot deployable portlet WAR.

2) Liferay 6.1.1 - Result: IT DOES INDEED WORK! emoticon

I started with the jsf2-jsp-portlet demo and replaced the contents of the src/main/webapp/views/portletViewMode.xhtml JSP view with the following:

<!--?xml version="1.0" encoding="UTF-8"?-->
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:liferay-portlet="http://liferay.com/tld/portlet" version="2.1">
    <jsp:directive.page contentType="text/html" pageEncoding="UTF-8" />
    <liferay-portlet:runtime portletName="101" />
</jsp:root>
Robert Kornmesser, geändert vor 10 Jahren.

RE: How to imped portlet inside jsf portlet ?

Junior Member Beiträge: 39 Beitrittsdatum: 03.11.11 Neueste Beiträge
Any news on how to solve this problem with facelets?

I would like to inclode social office portlet (notifications counter and message box) in my facelet.
thumbnail
Juan Gonzalez, geändert vor 9 Jahren.

RE: How to imped portlet inside jsf portlet ?

Liferay Legend Beiträge: 3089 Beitrittsdatum: 28.10.08 Neueste Beiträge
Hebatu Allah Fahmy:
Please , How can we imped portlet (e.g web content ) inside JSF portlet ?

Any help will be appreciated

Thanks in Advance


Hi Hebatu,

Hi,

New portal:runtime is implemented as part of this ticket:

https://issues.liferay.com/browse/FACES-2044

You can check it out in the Liferay Faces SNAPSHOT repository:

https://oss.sonatype.org/content/repositories/snapshots/com/liferay/faces/

for 3.2.x and 4.2.x versions.

You can check the showcase (here: https://github.com/liferay/liferay-faces/blob/master/demos/showcase/showcase-portlet/src/main/webapp/component/portal/runtime/multiple-instances/runtime.xhtml and here: https://github.com/liferay/liferay-faces/blob/master/demos/showcase/showcase-portlet/src/main/java/com/liferay/faces/demos/bean/RuntimeBacking.java) to know how to render web contents within a JSF portlet.

If you have any problem, please let us now.

Enjoy!