- This topic has 4 replies, 3 voices, and was last updated 19 years ago by Riyad Kalla.
-
AuthorPosts
-
DennieMemberThe validator for faces-config.xml gives an error when a Interface classname is used in a <managed-property>.
I think this is valid.Example:
<managed-bean> <managed-bean-name>modelService</managed-bean-name> <managed-bean-class>nl.dennie.model.impl.ModelImpl</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> <managed-bean> <managed-bean-name>modelView</managed-bean-name> <managed-bean-class>nl.dennie.ui.ModelView</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> <managed-property> <property-name>modelService</property-name> <!--- THIS GIVES AN ERROR --> <property-class>nl.dennie.model.Model</property-class> <value>#{modelService}</value> </managed-property> </managed-bean>
Greetz Dennie
Riyad KallaMemberDennie,
A managed property has to be instantiatable (sp?) in order for the value to be set. For example if you were to use a hard value here, like: “Bob Williams”, and your property was not a String, and instead a CharSequence, it would be impossible for JSF to set that property for you at runtime which is what it is suppose to be able to do.
DennieMemberHello rkalla,
I understand the basics of managed beans. And if you check the config file, it uses a Impl(!) class which instantiates the property. By the way: This config works in JSF (myfaces).
This is also very useful because I like to keep my source clean and work with interface properties instead of the hard implementing class. The red cross in my project just annoys me.Greets Dennie
support-eugeneMemberI will fire the PR to allow using abstract classes/interfaces as managed beans properties and referenced beans.
Riyad KallaMemberDennie,
My appologies, it looks like this should get corrected soon. -
AuthorPosts