I was expecting to be able to do something like this...

BeanA modifiedBeanA = loadBeanA();

FacesContext facesContext = FacesContext.getCurrentInstance();
ValueBinding vb =
facesContext.getApplication().createValueBinding("beanA");
vb.setValue(facesContext, modifiedBeanA);

return ("showBeanAContents");



-----Original Message-----
From: Jeffrey Porter [mailto:[EMAIL PROTECTED] 
Sent: 17 October 2005 17:38
To: MyFaces Discussion
Subject: RE: FacesContext/VariableResolver to get bean - how to set a
bean?


So if I have JSP-A with a button on, this links to an action.
The action loads some data into BeanA, then redirects to a new page
(JSP-B).
What do I have to do in the action class to get BeanA displayed on
JSP-B?

I've put in "value="#{myManagedBean.workNumber}"/>" but I'm at a loss of
what the action class must do with the bean.

Thanks

p.s> I may be approaching this problem in the wrong way. I'm a ex
Strut's Guy.
 :-)


-----Original Message-----
From: Mike Kienenberger [mailto:[EMAIL PROTECTED] 
Sent: 17 October 2005 17:29
To: MyFaces Discussion
Subject: Re: FacesContext/VariableResolver to get bean - how to set a
bean?

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 <[EMAIL PROTECTED]> 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
>
>

Reply via email to