aspose file tools*
The moose likes JSF and the fly likes More than one ManagedProperty ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "More than one ManagedProperty ?" Watch "More than one ManagedProperty ?" New topic
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: 16305
    
  21

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: More than one ManagedProperty ?