1 Reply Latest reply on Jun 4, 2008 11:33 AM by Peter Johnson

    invoque a Servlet into a portlet

    jbal khadija Newbie

      I want to use a servlet for the downalding of a file PDF, I tried to call it since my portlet with the following code ( in doView() method ):

      public void doView(RenderRequest req, RenderResponse rep)
      {
      rep.setContentType("text/html");
      String titre = (String) req.getParameter("titreformation");
      if (title !=null)
      {
      HttpServletRequest request = null;
      HttpServletResponse reponse = null;
      request.setAttribute("title", title);
       try {
       RequestDispatcher d = (RequestDispatcher) getPortletContext().getRequestDispatcher(
       "/MyServlet");
       d.include(request, reponse);
       } catch (ServletException se) {
       System.out.print se);
       }
      
      }


      but i have the following error:
      Cause: java.lang.ClassCastException: org.jboss.portal.portlet.impl.jsr168.api.PortletRequestDispatcherImpl
      Message: org.jboss.portal.portlet.impl.jsr168.api.PortletRequestDispatcherImpl
      StackTrace:
      java.lang.ClassCastException: org.jboss.portal.portlet.impl.jsr168.api.PortletRequestDispatcherImpl
       at portal.portlets.PListeFormation.doView(Unknown Source)
       at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:133)
       at javax.portlet.GenericPortlet.render(GenericPortlet.java:306)
       at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.invokeRender(PortletContainerImpl.java:483)



      Someone can help me please