1 Reply Latest reply on Oct 11, 2005 4:49 PM by Bradley Smith

    PortletRequestDispatcher didn't work

    Dong Zhang Newbie


      I am running jboss-4.0.3RC2 on Linux, JDK 1.5.0_04. Just try to show the help info.
      1) If I use PortletContext portletContext = getPortletContext(); I got null pointer exception, so I have to use session.getPortletContext();

      2) I am expecting the doHelp() will show the helpPage.jsp content, but the page is blank, no error/exception, could anyone point it out the reason,pls?

      thanks a lot

      Here is the final code
      protected void doHelp(RenderRequest req, RenderResponse resp)
      throws PortletException, IOException
      session = req.getPortletSession(true);
      PortletContext portletContext = session.getPortletContext();
      PortletRequestDispatcher prd = portletContext.getRequestDispatcher(resp.encodeURL(req.getContextPath())+"/jsp/helpPage.jsp");
      catch(PortletException pex)
      catch(IOException iex)


        • 1. Re: PortletRequestDispatcher didn't work
          Bradley Smith Master

          1.) Make sure your portlet extends javax.portlet.GenericPortlet
          2.) Try setting the response content type before dispatching
          3.) you might want to get rid of the encodeURL call

          I simply use

          PortletRequestDispatcher dispatcher = this.getPortletContext().getRequestDispatcher("/jsp/helpPage.jsp");
          dispatcher.include(request, response);

          with no problems

          Hope this helps.