Question

In our project we are changing the JSR version (from 168 to 286) of portlet projects. All the portlets are faces portlets and jsf version used is jsf1.2. We have several module but the structure is almost the same. Their are portlets in the left hand side, they act as left navigation for the users. On the right hand side we have the main portlets which hosts various application features. IPC is used to sent these selected values from the left portlet to the right portlet and accordingly the view is set for the portlet in the right.

In the processEvent method of the portlets the view of the target portlet is set based on the received values. Sample processEvent Method is as follows :

public void processEvent(EventRequest request, EventResponse response) throws PortletException, java.io.IOException 
    {   
        super.processEvent(request, response);
        Event sampleEvent = request.getEvent();
        if(sampleEvent.getName().toString().equals("ProcessEvent")) {
            Object sampleProcessObject = sampleEvent.getValue();
            System.out.println("Message Received : " + sampleProcessObject.toString());
            TargetPortletView obj = (TargetPortletView) request.getPortletSession().getAttribute("pc_TargetPortletView"); // Managed Bean associated with the target Page
            obj.setMessage(sampleProcessObject.toString());
            request.getPortletSession().setAttribute("com.ibm.faces.portlet.page.view","/TargetPortletView.jsp");//Target JSP is set
        }
    }

But if some faces navigation happens in the target jsp and the view is redirected to a a different jsp (eg A.jsp->B.jsp->C.jsp). Then again if a selection is done from the left portlet the view of the right portlet remains the same and is not updated though IPC happens properly. Please let me know if any other details is required. Thanks in advance.

Was it helpful?

Solution

The Rational Application Developer v9.0 help contains an entry Navigating to a different page in JSF portlet which explains a similar scenario.

OTHER TIPS

You need to reset the view of the Target portlet using the NavigationHandler. Use something like the following code. Where xxxxxxxxxx is, substitute it for a string that you have defined as a faces outcome that maps to the faces page you want to load (see navigation rule below - change as appropriate)

 // Reset view
FacesContext facesContex = FacesContext.getCurrentInstance();
NavigationHandler nav = facesContext.getApplication().getNavigationHandler(); nav.handleNavigation(facesContext, null, **xxxxxxxxxxx**);
                    facesContext.renderResponse();
                    super.saveViewState(facesContext);

                    facesContext.release();

-----------
in faces-config:

    <navigation-rule> 
        <from-view-id>/pages/*</from-view-id> 
        <navigation-case> 
          <from-outcome>reset</from-outcome> 
          <to-view-id>/TargetPortletView.jsp</to-view-id> 
        </navigation-case> 
     </navigation-rule> 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top