0 Replies Latest reply on Sep 23, 2007 7:49 AM by ameo

    Click Button on Portlet A , Portlet B navigates to a new pag

    ameo Novice

      Hello,

      I have to Portlets. When I click on a button in portlet A, I want that Portlet B
      navigates to a new side. The other examples e.g click a Button and changes text on the other Portlet works fine, but I want to manupulate the navigation.

      I tried this code in the ProcessAction-Method of Portlet B class, that's called after clicking on button of Portlet A:

      
      public class PortletB extends FacesPortlet{
      
      ..
      
      public void processAction(ActionRequest aRequest, ActionResponse aResponse) throws PortletException, IOException {
      
      ....
      LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
      
      Lifecycle lifecycle = lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
      
      FacesContext fc = (FacesContext) this.getFacesContextFactory().getFacesContext(portletSession.getPortletContext(),aRequest, aResponse, lifecycle);
      
      fc.getCurrentInstance().getApplication().getNavigationHandler().handleNavigation(fc.getCurrentInstance(), null,"moveit");
      
      ...
      


      Therefor the navigation rule is the following one

      <navigation-rule>
       <from-view-id>*</from-view-id>
       <navigation-case>
       <from-outcome>moveit</from-outcome>
       <to-view-id>/WEB-INF/jsp/MoveMe.jsp</to-view-id>
       </navigation-case>
       </navigation-rule>
      


      That doesn't work! I don't know, if this is the right way, to get the FacesContext from the processAction method of the PortletClass. Is this the right way? Do you have other ideas ?

      Greetings,
      ameo