Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Bean inside Managed Bean

how can i use a bean inside other bean ?

I use this solution, what's the best way ?

@ManagedBean(name="firstBean")
public class FirstBean implements Serializable{

  @ManagedProperty(value="#{myBean}")
  private MyBean myBean;
  ...
  //(get/set method)
}

I'm new in JSF and JSP so probably it's a bad practies.

like image 697
enfix Avatar asked May 21 '26 15:05

enfix


1 Answers

Your solution is the right one to inject another bean.

You only need the setter for the injected bean.

Are you having any issues\errors with it?

like image 199
Sully Avatar answered May 24 '26 06:05

Sully



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!