You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "urswagner@bluemail.ch" <ur...@bluemail.ch> on 2007/01/12 15:22:20 UTC
Access to managed bean
I would like to access in the Action class to the managed bean
class.
How can I do this?
<managed-bean>
<managed-bean-name>overviewBean</managed-bean-name>
</managed-bean>
In the action listener I would like to access to the managed bean
public class ExecuteActionListener implements ActionListener {
public void processAction(ActionEvent event)
throws AbortProcessingException {
HOW TO ACCESS TO THE overviewBean INSTANCE?
}
}
Thanks
Urs
Re: Access to managed bean
Posted by Simon Kitching <si...@rhe.co.nz>.
urswagner@bluemail.ch wrote:
> I would like to access in the Action class to the managed bean
> class.
> How can I do this?
http://wiki.apache.org/myfaces/AccessingOneManagedBeanFromAnother
Re: Access to managed bean
Posted by Harlan Iverson <h....@gmail.com>.
oops, I botched that one. here is the full code
FacesContext ctx = event.getComponent().getFacesContext();
OverviewBean overviewBean =
ctx.getApplication().createValueBinding("#{overviewBean}").getValue(
ctx );
On 1/12/07, Harlan Iverson <h....@gmail.com> wrote:
>
> you can either make the ActionListener a method of overviewBean or you can
> use create a ValueBinding:
>
> public void processAction(ActionEvent event) throws
> AbortProcessingException {
> OverviewBean overviewBean = event.getComponent
> ().getFacesContext().getApplication().createValueBinding("#{overviewBean}")
> }
>
> Harlan
>
>
> On 1/12/07, urswagner@bluemail.ch <ur...@bluemail.ch> wrote:
> >
> > I would like to access in the Action class to the managed bean
> > class.
> > How can I do this?
> >
> > <managed-bean>
> >
> > <managed-bean-name>overviewBean</managed-bean-name>
> >
> > </managed-bean>
> >
> > In the action listener I would like to access to the managed bean
> >
> > public class ExecuteActionListener implements ActionListener {
> >
> > public void processAction(ActionEvent event)
> > throws AbortProcessingException {
> >
> > HOW TO ACCESS TO THE overviewBean INSTANCE?
> > }
> >
> > }
> >
> > Thanks
> >
> > Urs
> >
> >
> >
>
Re: Access to managed bean
Posted by Harlan Iverson <h....@gmail.com>.
you can either make the ActionListener a method of overviewBean or you can
use create a ValueBinding:
public void processAction(ActionEvent event) throws AbortProcessingException
{
OverviewBean overviewBean = event.getComponent
().getFacesContext().getApplication().createValueBinding("#{overviewBean}")
}
Harlan
On 1/12/07, urswagner@bluemail.ch <ur...@bluemail.ch> wrote:
>
> I would like to access in the Action class to the managed bean
> class.
> How can I do this?
>
> <managed-bean>
>
> <managed-bean-name>overviewBean</managed-bean-name>
>
> </managed-bean>
>
> In the action listener I would like to access to the managed bean
>
> public class ExecuteActionListener implements ActionListener {
>
> public void processAction(ActionEvent event)
> throws AbortProcessingException {
>
> HOW TO ACCESS TO THE overviewBean INSTANCE?
> }
>
> }
>
> Thanks
>
> Urs
>
>
>