Navigate from JSR286(IBM) portlet to JSF 2.0 portlet - jsf-2

I need to redirect with some parameter from JSR286(IBM) portlet to JSF 2.0 portlet.
I am having the page unique id and friendly url too.
I have tried response.sendRedirect() and requestDispatcher.forward() but no success till now.
Please provide me some solution.

For navigating between portlets you should not simply forward or redirect pages, since this is not the way to go. The proper way to communicate between portlets, even on different pages is to use interportlet-communication (IPC), commonly known as portlet wiring.
But it all depends on what you mean with a "JSR286(IBM) portlet". A portlet is either a JSR-286 portlet following the global specs (which are the same for all vendors, IBM, Apache, Oracle, Liferay, ...) or you have a portlet using the IBM API/iWidgets, in the last case, portlet wiring is not possible if I remember correctly from the docs.
Anyways, JSF or not, a JSF 2.0 portlet remains a JSR-286 portlet, so you can use normal events in this case as well, though I'm not experienced in JSF. Both portlets should have a portlet descriptor, in which you can declare:
The event, using <event-definition>. Please note that when your JSF-portlet is in a separate portlet application (in a different portlet.xml file), you will have to use an XName, not a normal name.
The events a specific portlet can publish, using <supported-publishing-event> (your JSR-286 portlet)
The events a specific portlet can subscribe to, using <supported-processing-event> (your JSF 2.0 portlet)
Afterwards, you can send an event in your JSR-286 portlet from within the ACTION phase, by using the ActionResponse.setEvent() method.
From the JSF 2.0 portlet, you should still be able to get the PortletRequest/PortletResponse from the context. If you check if it is an instance of EventRequest, you can retrieve the parameter using EventRequest.getEvent(), allowing you to pass parameters between portlets.
If your portlets are on separate pages, you'll have to got the Administration of WebSphere Portal (I assume you're running that since you're talking about IBM), and define global targets for the pages so that events can be triggered cross-page (otherwise wiring is only available for portlets within the same page).

Related

Vaadin7 themes in Websphere Portal

I would deploy my Vaadin custom themes in Websphere and reference them in some vaadin portlets deployed in Websphere Portal.
I'm using Websphere 8.5 and Vaadin 7. I found a lot of topic about the Tomcat and Liferay combination but nothing usefull for Websphere.
I also tried to set the vaadin.resources.path variable in the 'WP PortletContainerService' in Resources>Resource Environment>Resource Environment Providers and I set a resource with name 'std.portalcontext.vaadin.resources.path' but I can't see it in UI.
​Thank you.
Setting that property on the portletcontainerservice is not going to help you because it is not one of the properties that the WebSphere Portal container is going to recognize as a property. I think you may have to do something like this https://vaadin.com/forum/#!/thread/2732876/2732875 specifically these https://vaadin.com/wiki?p_p_id=36&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=row-1&p_p_col_pos=1&p_p_col_count=3&_36_struts_action=%2Fwiki%2Fview&p_r_p_185834411_nodeName=vaadin.com+wiki&p_r_p_185834411_title=Developing+portlets+for+the+Websphere+Portal+Server
The main thing to do is this
In the portlet tag you have to set a value for the portlet-class. For this simple we can use the default Vaadin portlet class com.vaadin.server.VaadinPortlet; you also have to name you UI class as a portlet init parameter.
To let WPS find the Vaadin javascript and theme resources you have to use the portlet init parameter vaadin.resources.path. The value PORTLET_CONTEXT is a Vaadin constant value that makes the vaadin resources available in the portlets resource path.
Run the Maven build with clean package as goals and deploy the created war file in the portal administration. Create a blank portal page and add your portlet to the page. Your "Click me" portlet should look like this:

Liferay portlet direct URL?

Is it possible to query portlet interior directly from web browser? Which URL I should use given a portlet name and web application name?
AFAIK the whole point of portlets is to not generate standalone pages.
What you can do is make a page in liferay with your portlet occupying the whole page (which means apropriate theme and layout template) and pass a link to that.
Note that 'MAXIMIZED' portlet state will only maximize it to fill the portlet area in the theme, so you'll need a 'full screen' theme anyway.
Like Julien Lafont hinted in another comment, Liferay adds two window states:
Exclusive (LiferayWindowState.EXCLUSIVE)
Popup (LiferayWindowState.POP_UP)
Exclusive only outputs the portlet content, without any decoration, and without any proper html/js/css surroundings. It's useful for embedding in a DOM with those surroundings.
Popup outputs the portlet content, surrounded by all html/js/css to properly display the portlet. Used to display portlets in a popup (iframe) for example.

Force portlet render from other port let in Liferay 6.0.6

Is there any way I can force the render of a port let in Liferay?
I'm using Liferay 6.0.6 and I want to set a value into a session variable and force other port let to render to be able to update fragment of this second portlet as it reads this variable.
In the portlet development I am using JSF 2.0 (Mojarra) and PrimeFaces
In case this is impossible. Any other suggestion to achieve it? How can two port lets communicate to update a fragment of one of them?
Thanks in advance.
You could do a Google for Ajax Push in PrimeFaces, and you will find some resources. Ajax Push can also be used in a portlet context. We've been using Ajax Push in ICEfaces, but it seems that PrimeFaces supports the same. I did however came across this issue, but I don't know if it's still relevant for the version you're using at the moment.

JSF 2.0 javax.faces.webapp.FacesServlet mappig

I started to use JSF 2.0 recently and I don't understand completely how I need to configure the javax.faces.webapp.FacesServlet to correctly handle resources.
For example, If I decided to create a web application with .xhtml files and .jsp files and I want both them to use jsf technology how am I supposed to configure the jsf servlet to handle both?
Sometimes I found example where the servlet url pattern is just /faces/*
thanks!
I suggest to use a suffix pattern as URL pattern like *.jsf. If a Facelets file (.xhtml) is present on the given view ID, then it will be served. Otherwise if a JSP file (.jsp) is present on the given view ID, then it will be served. This also gives you the room to gradually upgrade from JSP to Facelets without the need to change URLs, so that you can ultimately get rid of those legacy JSPs in an easy way.

Liferay - Struts2 Portlet sample

I am working with struts2 portlet sample and deployed in liferay portel using liferay server. It is working fine. But now I am trying to validate my form even that working perfectly for first time. But after first attempt when form is submitted with desired values it is not proceedin further and not recogonizing the desired action too.
Can anybody helm me in this issue.
Thanks in advance
We have the same setup and have had numerous problems with making struts 2 work nicely with the portlet api. We had the same problem as you early on. Are you using the bridge provided with the struts 2 distribution?
One thing that doesn't work with the bridge is chained actions - you can't have an action that redirects to another action. We did som coding of our own to solve it where the action classes figures out which action that is next. (Our application is a step-by-step guide where steps are included or not dependings on what you have entered previously.)
You might put some break points in PortletStateInterceptor and verify that your action state is getting save and then restored. Note that in portlets there is an action phase and a render phase and if you find the DirectRenderRequest action on the top of the stack instead of yours then you're probably not saving the valuestack state during the action phase.

Resources