On Sun, 19 Sep 2004 15:44:14 +0530, ravi naraharasetty <[EMAIL PROTECTED]> wrote: > Hi All, > > How do I access JSF Managed Bean which is in session scope into a > Struts Action Class. >
Assume you have a managed bean named "foo" that you'd like to access, of type FooBean. FacesContext fc = FacesContext.getCurrentInstance(); ValueBinding vb = fc.getApplication().createValueBinding("#{foo}"); FooBean foo = (FooBean) vb.getValue(fc); Since you have "foo" defined as a managed bean, it will be instantiated on demand if necessary. Besides simple expressions like this, you can programmatically evaluate any legal value binding expression using the technique above. In addition, value bindings can be used to modify things as well -- if FooBean has a String property named "name", then you can update it like this: FacesContext fc = FacesContext.getCurrentInstance(); ValueBinding vb = fc.getApplication().createValueBinding("#{foo.name}"); vb.setValue(fc, "New value for the name"); > Thanks & Regards, > Kumar. Craig --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]