5 Replies Latest reply on May 22, 2008 4:55 AM by je le

    Problem regarding renderURL param

    ruchika garg Newbie

      Hello,

      I am facing a problem while using renderURL.
      My scenario:
      I have two tabs: Home, Test.
      Test tab has one portlet in which a jsp(Say testTabHome.jsp) is being displayed. This jsp has links (renderURL with param value say state).
      Depending on state i m showing the respective pages (say testTabPageA.jsp,testTabPageB.jsp....) in same portlet.

      Now suppose last page visited is testTabPageA.jsp (using link).

      The problem is that when I am clicking on Home tab , the home page is getting displayed(correctly) but when I am again clicking on Test tab, instead of testTabHome.jsp, the last page (testTabPageA.jsp in this case) visited under Test tab is getting displayed.

      Any help in this regard will be greatly appreciated.

      Regards,
      Ruchika

        • 1. Re: Problem regarding renderURL param
          Thomas Heute Master

          If i understand what you are doing, this is the expected behavior.

          Now if you want to reset the state on each page refresh, try this (with JBoss Portal 2.6.5 only):

          Uncomment:
          <!-- depends-list-element>portal:service=Interceptor,type=Command,name=CleanNS</depends-list-element -->

          In:
          jboss-portal-2.6.5.GA/server/default/deploy/jboss-portal.sar/META-INF/jboss-service.xml

          Then restart

          And please let me know if that gives the behavior you expected.

          • 2. Re: Problem regarding renderURL param
            ruchika garg Newbie

            Sorry I forgot to mention the version of JBoss Portal.
            I am using jboss-portal-2.6.4.
            I couldn't find

            <!-- depends-list-element>portal:service=Interceptor,type=Command,name=CleanNS</depends-list-element -->

            in file specified by you.

            Regards,
            Ruchika

            • 3. Re: Problem regarding renderURL param
              Thomas Heute Master

              It's only available in 2.6.5

              • 4. Re: Problem regarding renderURL param
                ruchika garg Newbie

                Is there any other way with the help of which I can achieve the requierd behaviour?

                Regards,
                Ruchika

                • 5. Re: Problem regarding renderURL param
                  je le Newbie

                  with plain jsp i don't know, but using a little trick inside the portlet do view you could.

                  the problem is from the processAction / doView method. doView keep renderParam (set in processAction), therefore, render 'old' data when switching back using the tab button. Unfortunately ActionRequest doesn't allow us to remove a renderParam - That would solve the problem - I tried using Attributes, properties but none seem to work.

                  The 'trick' I'm using in a similar problems is to pass param from processAction to doView using... session ! yes, it's quite dirty. Sample :

                  public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException {
                  
                   PortletSession session = request.getPortletSession(true);
                   if (session != null) {
                   String todo = request.getParameter("articleedit_todo");
                   session.setAttribute("todo", todo);
                   }
                  //......
                  }
                  
                   public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
                  //.......
                  PortletSession session = request.getPortletSession(true);
                  Object todo = session.getAttribute("todo");
                   session.setAttribute("todo", null);
                   if ((todo == null ? "" : todo.toString()).compareTo("goedit") == 0) {
                   getPortletContext().getRequestDispatcher("/WEB-INF/jsp/articles/ACAdminArticleEditPortlet_view.jsp").include(request, response);
                   } else {
                   getPortletContext().getRequestDispatcher("/WEB-INF/jsp/articles/ACAdminArticlePortlet_view.jsp").include(request, response);
                   }
                  }
                  }


                  A+