1 Reply Latest reply on Nov 27, 2006 5:10 AM by Naiden Gochev

    SetRenderingParameter to renderer method dont work :( or i m

    Naiden Gochev Newbie

      i want just to show one text when submit a form ..
      i try this with dispatcher and 2 jsps but dont work so i try the easy version but dont work too.
      public class TestPortletAction extends GenericPortlet
      {
      public class TestPortletAction extends GenericPortlet
      {
      response.setRenderParameter("secound","sec"); //hard coded value
      } protected void doDispatch(RenderRequest request, RenderResponse response) throws PortletException, IOException
      {
      // Do nothing if window state is minimized.
      WindowState state = request.getWindowState();
      if (state.equals(WindowState.MINIMIZED))
      {
      super.doDispatch(request, response);
      return;
      }

      // Get the content type for the response.
      String contentType = request.getResponseContentType();
      response.setContentType(contentType);

      // Get the requested portlet mode.
      PortletMode mode = request.getPortletMode();

      // Dispatch based on content type and portlet mode.
      if (contentType.equals("text/html"))
      {
      if (mode.equals(PortletMode.VIEW))
      {
      doViewHtml(request, response);
      return;
      }
      else
      {
      super.doDispatch(request, response);
      }
      }
      else
      {
      super.doDispatch(request, response);
      }
      }

      private void doViewHtml(RenderRequest request, RenderResponse response) throws PortletException, IOException
      {
      // To do: markup the required content.
      PortletURL submitUrl = response.createActionURL();

      PrintWriter out = response.getWriter();
      String secound="none";
      out.print("Welcome");
      out.print(", this is the view mode.");
      out.println("");
      out.println("<form method='POST' action='" + submitUrl + "'>");
      out.println("");
      out.println("vavedi neshto:");
      out.println("<input type='text' name='secound' value='" + secound + "'>");
      out.println("");


      out.println("<input type='submit'");
      out.println("");

      String sec=(String)request.getAttribute("secound");
      if(sec !=null )
      {
      out.println("SEC IS NOT NULL ! : "+sec ); //i never see this :)
      }
      }

      so as you gues the request.getAttribute("secound"); is aways NULL ..
      why ?

      i try to set the request parameter on processAction too

      response.setRenderParameter("secound","sec");

      request.setAttribute("secound","sec");

      but the secound is null again