How to create a reference from one portlet to another?

181 Views Asked by At

I am using Spring portlet MVC framework with Oracle WebLogic Portal.

I have a page with a few portlets. For example page#1 (contains 2 portlets - portlet#1 and portlet#2) and another page - page#2 with two more portlets (portlet#3 and portlet#4)

The first portlet on the first page (portlet#1) contains a link. I want to go to the page which belongs to the portlet#3 (is located on another page !!!).

How can I do this ?

To create a connection between two portlets within one page (which contain these portlets) is not a problem. But is it possible to move between different portlets which are localed on different pages ???

1

There are 1 best solutions below

0
On

This is similar to this question Spring Portlet MVC sentRedirect and setRenderParameter

You could use a redirect in portlet#1 to link to page#2

Portlet Controller portlet#1

@ActionMapping("doGotoPage2")
public void doGoToPage2(ActionRequest req,
    ActionResponse resp) {

 try {
    resp.sendRedirect("/url/to/page#2");
 } catch (IOException ex) {
    Logger.getLogger(DefaultViewController.class.getName()).log(Level.SEVERE, null, ex);
 }
}

and also set an attribute to PortletSession

 PortletSession session = req.getPortletSession();
 session.setAttribute("key", "value", PortletSession.APPLICATION_SCOPE);

Then you can read the PortletSession in portlet#3 and handle it accordingly

PortletController portlet#3

PortletSession session = req.getPortletSession();
String sessionKey= (String) session.getAttribute("key", PORTLET_SESSION_SCOPE);