[jboss-user] [JBoss Portal] - JBoss Portal Request Parameters

ghyoju do-not-reply at jboss.com
Thu Mar 8 16:55:32 EST 2007


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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4026439#4026439

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026439



More information about the jboss-user mailing list