Recommended way to get request parameters

Is there a recommended way to get URL request parameters like:

javax.servlet.http.HttpServletRequest request = (javax.servlet.http.HttpServletRequest)com.webMethods.portal.framework.impl.PortalServlet.getCurrentRequest();

    String myUrlParameter= (String) request.getParameter("myUrlParameter");

I have been doing this successfully in the “beforeRenderResponse” method to ensure it always gets checked, but thought it should occur earlier in the jsf lifecycle.

Thanks!

1 Like

That is a fine technique for getting a ‘naked’ URL param using an MWS specific API.

However, if you are using (Extended) PortletURLs, you can read them off the current portlet request via the faces ExternalContext API (ie
getFacesContext().getExternalContext().getRequestParameterMap().get(“myParam”).

You can also read them in a binding expression via the “param” implicit
variable (ie #{param[“myParam”]}).

Regards,
–mark

1 Like

Hi Mimel,

I don’t know if i can use the methods on the top to recover the value of my param using an htmlCommandLink, i don’t know if i can read them off the current portlet request via the faces ExternalContext or in a binding expression ??

my action returns always a NULL value:


	public String domaineSelected() {
	    String value = (String)resolveExpression("#{param['domaineParam']}");  
	    //String value2 = (String)getFacesContext().getExternalContext().getRequestParameterMap().get("domaineParam"); 
	    return value;
	}	

knowing that my param contains always a value on the url request :

Thanks and regards