You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Jeffrey Porter <PO...@WMGMAIL.wmg.warwick.ac.uk> on 2005/10/17 18:22:13 UTC

FacesContext/VariableResolver to get bean - how to set a bean?

 

I understand how to get a bean from a jsp using FacesContext &
VariableResolver.

 

Yet when I redirect to a new page I want it to display a form containing
data from a bean I've already populated.

 

I can do this with tables since I've created a managed-bean that is used
in a h:dataTable tag.

 

But with a page that has textfields/radio buttons etc. How do I populate
them?

 

Hope my question makes sense. 

 

If anyone can point me in the direction of some info, it would be great.

 

Thank

Jeff

 


Re: FacesContext/VariableResolver to get bean - how to set a bean?

Posted by Mike Kienenberger <mk...@gmail.com>.
You'd just set the value attribute of the component to point to your
managed bean.

<h:outputText id="workNumberInput" value="#{myManagedBean.workNumber}"/>

If "myManagedBean" has request scope, you'll need to preserve it using
t:saveState so it's still available on the next page.   I'm not
certain that you can do this if you use a <redirect /> tag in your
navigation rules, so you'd have to use some other method to preserve
them (session-scoped bean, maybe, or change to server-side state
management.)

On 10/17/05, Jeffrey Porter <PO...@wmgmail.wmg.warwick.ac.uk> wrote:
>
>
>
>
>
> I understand how to get a bean from a jsp using FacesContext &
> VariableResolver.
>
>
>
> Yet when I redirect to a new page I want it to display a form containing
> data from a bean I've already populated.
>
>
>
> I can do this with tables since I've created a managed-bean that is used in
> a h:dataTable tag.
>
>
>
> But with a page that has textfields/radio buttons etc. How do I populate
> them?
>
>
>
> Hope my question makes sense.
>
>
>
> If anyone can point me in the direction of some info, it would be great.
>
>
>
> Thank
>
> Jeff
>
>