You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by mfaine <mf...@knology.net> on 2005/02/14 20:06:35 UTC

can't add value to request parameter map

I am trying to do the following in my actionListener method.

FacesContext context = FacesContext.getCurrentInstance();
context.getExternalContext().getRequestMap().put("selectedDocument", document);

later I try to retrieve with:


Document doc = ( Document ) FacesContext.getCurrentInstance ().
                   getExternalContext ().getRequestParameterMap ().get (
        "selectedDocument" );

but it is null?

How can I ensure that a value is passed via request?

Thanks,
-Mark


Re: can't add value to request parameter map

Posted by Martin Cooper <ma...@apache.org>.

On Mon, 14 Feb 2005, mfaine wrote:

> I am trying to do the following in my actionListener method.
>
> FacesContext context = FacesContext.getCurrentInstance();
> context.getExternalContext().getRequestMap().put("selectedDocument", document);

This should have resulted in an UnsupportedOperationException. You can't 
add parameters to the request in JSF, just as you can't do that in 
Servlets either.

> later I try to retrieve with:
>
>
> Document doc = ( Document ) FacesContext.getCurrentInstance ().
>                   getExternalContext ().getRequestParameterMap ().get (
>        "selectedDocument" );
>
> but it is null?
>
> How can I ensure that a value is passed via request?

You probably want a request attribute instead of a request parameter.

--
Martin Cooper


> Thanks,
> -Mark
>
>