Hi,
In JSF2, how can i pass objects from one requestscoped bean to another requestscoped bean? I really don't want to make them sessionscoped.
Maybe can i inject one bean in the other?
Thank you.
Hi,
In JSF2, how can i pass objects from one requestscoped bean to another requestscoped bean? I really don't want to make them sessionscoped.
Maybe can i inject one bean in the other?
Thank you.
Use the ManagedProperty annotation:
@ManagedBean(name="beanA") @RequestScoped
public class BeanA implements Serializable {
@ManagedProperty(value="#{beanB}")
private BeanB beanB;
public void setBeanB(BeanB b) { this.beanB = b; }
public BeanB getBeanB() { return beanB; }
}
@ManagedBean(name="beanB") @RequestScoped
public class BeanB implements Serializable {}
I haven't tested that code. You can achieve similar results by defining managed properties in faces-config.xml
.