0 Replies Latest reply on Mar 8, 2007 4:55 PM by Gyanendra Hyoju

    JBoss Portal Request Parameters

    Gyanendra Hyoju Newbie

      Hi

      AS JBOSS 4.0.5
      PORTAL JBOSS Portal 2.4.1


      I have some hidden form variables in JSP

      When I submit the form, I cannot access these in request parameters in the Portlet or ActionClass. although while debugging I can see these parameters inside hidden/protected variable when :

      In Portlet these parameters can be seen in

      "request.requestContext.req.request.parameterMap "

      In ActionClass they can be seen in

      "request.request.dreq.request.parameterMap"



      This is the code in doRenderer() method of Extended Protlet

      protected void doRender(RenderRequest request, RenderResponse response) throws PortletException, IOException {
      WindowState state = request.getWindowState();
      response.setContentType("text/html");

      //requestUri can be passed by request parameter
      //or in request attribute
      //or defined in portlet init parameter
      String requestURI = (String)request.getAttribute(MVCConstants.PARAM_REQUEST_URI);

      if(requestURI == null){
      requestURI = (String)request.getParameter(MVCConstants.PARAM_REQUEST_URI);
      }
      if(requestURI == null) {
      requestURI= _requestURI;
      }

      request.setAttribute(MVCConstants.PARAM_REQUEST_URI,requestURI);

      PortletContext context = getPortletContext();

      PortletRequestDispatcher rd = context.getRequestDispatcher(requestURI);
      rd.include(request, response);
      }
      }



      This is the code in execute() method in ActionClass


      public static final String execute(HttpServletRequest request,HttpServletResponse response)
      throws Exception
      {
      String requestURI = (String)request.getAttribute(MVCConstants.PARAM_REQUEST_URI);
      String dispatchAction = (String)request.getAttribute(MVCConstants.PARAM_DISPATCH_ACTION);
      String operation = (String)request.getAttribute(MVCConstants.PARAM_OPERATION);

      if(dispatchAction == null || dispatchAction.trim().length()<=0){
      request.setAttribute(MVCConstants.ERROR_MESSAGE,MVCConstants.PARAM_DISPATCH_ACTION +" information is not provided for " + requestURI + " check mvc_config.xml");
      return MVCConstants.FORWARD_ERROR;
      }

      if(operation == null|| operation.trim().length()<=0){
      request.setAttribute(MVCConstants.ERROR_MESSAGE,MVCConstants.PARAM_OPERATION +" information is not provided for " + requestURI + " check mvc_config.xml");
      return MVCConstants.FORWARD_ERROR;
      }
      try{
      Class dispatchClass = Class.forName(dispatchAction);

      Class parameters[] = new Class[2];
      parameters[0] = HttpServletRequest.class;
      parameters[1] = HttpServletResponse.class;

      Method method = dispatchClass.getMethod(operation,parameters);

      Object args[] = new Object[2];
      args[0] = request;
      args[1] = response;
      return (String)method.invoke(dispatchClass.newInstance(),args);
      }
      catch(Exception e){
      e.printStackTrace();
      request.setAttribute(MVCConstants.ERROR_MESSAGE,e.getMessage());
      return MVCConstants.FORWARD_ERROR;
      }
      }


      Thank you very much.