| Author |
More than one ManagedProperty ?
|
michael nik
Greenhorn
Joined: Mar 11, 2012
Posts: 15
|
|
I have the following beans:
Also, I am using a property to use the above bean in my second class named MyBean2.java
Everything is working properly. Now, something is going wrong in my class MyBean2.java when I add a second bean property e.g @ManagedProperty(value="#{mybean3}") from a third class MyBean3.java
Is it feasible to happen, to whit having 2 different @ManagedProperty values in a third class MyBean3.java ?
Thank you
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14456
|
|
I do much more complex things than that routinely.
However, I see two issues:
1. You have a ManagedBean, but the ManagedBean and SessionScoped annotations are not made on the class definition, but rather inside the class body. I'm surprised that the compiler didn't outright reject that.
2. When you have a managed property, that property required an explicit public setter method according to the JavaBeans convention. Id est, you cannot call it "setUser1" and expect JSF to find it - it has to be named "setMybean1. The mybean1 property gains nothing from being declared public. Except that doing so means that application logic could could directly modify its value without going through a common mutator. JSF, however, will not. It requires the "set" method.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
 |
|
|
subject: More than one ManagedProperty ?
|
|
|