When you say you're using the jsf-spring integration, are you using
the jsf-spring sourceforge project? If not, I'd recommend switching
over to that as this should allow you to have two-way sharing of
registered beans.
On 10/9/05, James Flynn <[EMAIL PROTECTED]> wrote:
>
> Hi Simon,
>
> Thanks so much for your help! I tried your solution outlined below, but got an
> exception:
>
> Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No
> bean named '#{dataBean}' is defined:
> org.springframework.beans.factory.support.DefaultListableBeanFactory defining
> beans
>
> We are using the spring/jsf integration, so it seems to me that Spring is
> "injecting" itself into this managed bean facility. So it seems we must
> register our DataBean with Spring for this to work. But I'm guessing we need
> to
> continue to register it in faces-config as well, as the DataBean is a "backing
> bean" in the JSF side of things. Does this sound right to you?
>
> Kind regards,
> James
>
> --- Simon Kitching <[EMAIL PROTECTED]> wrote:
>
> > James Flynn wrote:
> > > Hi All,
> > >
> > > This seems like a simple problem, but we have been
> > > unable to find a solution in the documentation. We are
> > > new to JSF, so please excuse us if the answer is
> > > obvious to someone with more experience:
> > >
> > > Basically we have a form whose fields are all bound to
> > > a data bean, which is a managed bean. We do not want
> > > to put the action code right in this bean, so we have
> > > created another managed bean for that, call it the
> > > "controller". The problem is thus: how do we gain
> > > access to the "data bean" from the controller?
> > >
> > > We were originally using the following code to do
> > > this:
> > >
> > > DataBean dataBean =
> > > (DataBean)FacesUtils.getManagedBean("DataBean");
> > >
> > > But when we switched from the JSF reference
> > > implementation to MyFaces, this did not work anymore
> > > (it gave us back a new unbound bean instead, with all
> > > properties set to null). I am assuming we are doing
> > > something wrong, or is this a bug in MyFaces? What is
> > > the recommended way to do this?
> >
> > You can use "injection" defined in the managed bean section to connect
> > the beans:
> >
> > <managed-bean>
> > <managed-bean-name>Controller</managed-bean-name>
> > ...
> > <managed-property>
> > <description>databean object</description>
> > <property-name>dataBean</property-name>
> > <property-class>our.data.package.DataBean</property-class>
> > <value>#{dataBean></value>
> > </managed-property>
> >
> >
> > Method Controller.setDataBean will then be called with the databean as a
> > parameter before any ActionListener callbacks occur.
> >
> > Regards,
> >
> > Simon
> >
>
>
>
>
>
>
>
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
>