Install JBoss tools. Then by adding <nature>org.jboss.tools.jsf.jsfnature</nature>
to the natures
section of the .project
file, the support improved in my Eclipse J2EE Helios edition. (This step is probably equal to Configure->Add JSF Capabilities
in the project settings.) The context completion then works for cc.attrs.<ctrl-space>
when building component compositions, but sadly still not for any @ManagedBean
s.
Switch from ManagedBeans to CDI: I changed all @ManagedBean
s to @javax.inject.Named
and the scopes to @javax.enterprise.context.*Scoped
etc. I also enable CDI Support in the project settings. Then I get context completion on beans in .xhtml
!
First limitation: It only works when the EL is part of an attribute value. It does not work if you just use #{EL}
somewhere else on the .xhtml
page.
Second limitation: If you define the name of your bean via a constant, it is not recognized for context competion: Does not work: @Named(value = MyBean.BEANNAME)
. You have to set the name as a String, like: @Named(value = "myBean")
Third limitation: If you use parameterised method calls (e.g. with Tomcat7 or Glassfish), this is not supported by autocomplete. The autocomplete only shows get/set/is properties of the bean.
Note: It works out of the box in Netbeans 7.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…