webtier@glassfish.java.net

Re: [webtier] Using _at_ManagedProperty

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Wed, 16 Sep 2009 11:00:01 -0700

Per the specification, setters are still required in order for the
'injection' to take place.


On 9/16/09 10:48 AM, webtier_at_javadesktop.org wrote:
> I think I am misunderstanding how to use @ManagedProperty. I tried this:
>
> =======Test2.java========
> @ManagedBean
> public class Test2 {
> @ManagedProperty(value="#{test1}")
> private Test1 t;
>
> public String getMessage() {
> return "I am Test2, message from Test1 is " + t.getMessage();
> }
> }
> =======Test1.java========
> @ManagedBean
> public class Test1 {
> public String getMessage() {
> return "I am Test1";
> }
> }
> ======test.xhtml=========
> ...
> #{test2.message}
> ...
> =======Result========
> [Mojarra 2.0.0 (Beta1 b13)]
>
> SEVERE: JSF will be unable to create managed bean test2 when it is requested. The following problems where found:
> - Property t for managed bean test2 does not exist.
>
> I suspect that I am overlooking the obvious. What did I miss?
>
> Thanks!
>
> - Marty
> http://www.coreservlets.com
> [Message sent by forum member 'martyhall' (hall_at_coreservlets.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=364245
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>
>