java - EL throws PropertyNotFoundException when method is static -


given following jsf code:
<h:outputtext value="#{bean.foo}" />
, proper method in bean:
public string getfoo(){ return "foo"; }
works great. when switch bean's method static
public static string getfoo(){ return "foo"; }
not work anymore, because el throws exception:

javax.el.propertynotfoundexception: class 'bean' not have property 'foo'.

why method must not static?

by making foo static no longer fits definition of property of class. can still call getfoo() directly, won't autowire when constructed way you've changed it


Comments