On 8/29/05, Rick Reumann <[EMAIL PROTECTED]> wrote:
> On 8/29/05, Craig McClanahan <[EMAIL PROTECTED]> wrote:
> >  
> > That is indeed a GET request.  You can fire a GET request at a JSP
> > page just fine (including query parameters) ... the thing you give up
> > is state restoration, since your request won't include any state
> > information. 
> 
>  
>  But what's the most efficient way to handle this in a JSF backing bean? In
> other words are you forced to have to do...
>  
>  FacesContext context = FacesContext.getCurrentInstance();
>  Map reqParams = context.getExternalContext().getRequestParameterMap();
>  String fooBar = (String)reqParams.get("fooBar");
>  
>  Isn't there a way to make sure the property of my backingBean, in this case
> "fooBar," is populated automatically after clicking on a link that is to
> handle this Request where "fooBar" is passed as a parameter of the URL? (In
> a similar way an ActionForm property is set that backs an Action in Struts?)

Not with pure JSF.  The kind of updating you are talking about is done
in the Update Model Values phase of the request processing lifecycle
... but that is only executed if there was any state restored, and
doesn't happen on a GET request (which goes directly to Render
Response phase).

What you could do yourself, for example, is take the reqParams map you
extracted above and pass it to BeanUtils.copyProperties() as the
"source" bean, with some suitable backing bean as the destination. 
That's essentially what Struts does to populate an ActionForm.  But,
be aware that you don't get the benefits of conversion or validation
either, so make sure you're using String properties.

Craig

>  
> -- 
> Rick

Reply via email to