JSF 2.0 and other issues in Visual Editor
henk53 Jan 29, 2011 10:57 AMWhen using JSF 2.0 & Facelets, a few problem occur in the JBoss Tools Visual Editor. I'm using 3.2 CR1.
EL methods with parameters
When I call a method via EL with parameters (which thus results in a value) an error is flagged:
Because a method is involved, the editor seems to think it's a method expression, but this is clearly not the case. Even with the == operator no method expression is involved here. The == operator should even make it more clear the component to which this EL expression is bound will receive a value.
Needless to say, the code runs perfectly well on JBoss AS 6.
Annotated managed beans
When I annotate a JSF managed bean instead of declaring it in faces-config.xml, the editor does not seem to have any knowledge of the bean. Neither navigate into and auto-completion work. E.g. if I have the following bean:
import javax.annotation.PostConstruct; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import javax.faces.event.ActionEvent; @ManagedBean @ViewScoped public class MyBean { public String getFoo() { return "foo"; } public void setFoo(String foo) {} }
And a simple Facelet using this bean:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"> <h:body> <h:outputText value="#{myBean.foo}" /> </h:body> </html>
Then I can't do anything in the editor with "myBean". Here too, the code runs fine on JBoss AS 6.
Implicit EL Objects
The editor does not seem to have full knowledge about the EL implicit objects. When trying to auto-complete an EL expression bound to a component, e.g. <h:outputText value="#{...}"/> certain EL implicit objects pop up, but others not.
Available are:
- applicationScope
- component
- cc
- cookie
- facesContext
- flash
- header
- headerValues
- initParam
- param
- paramValues
- requestScope
- resource
- sessionScope
- view
- viewScope
Missing are thus:
- application
- request
- session
Then for some of those implicit EL objects it makes sense to be able to navigate into them and have auto-completion. This is exactly what the default Eclipse 3.6.1 "HTML Editor" allows. E.g. navigating into view would bring me to UIViewRoot and navigating into component would bring me to UIComponent. For auto-completion this is even more convenient.
Finally, for some reason implicit objects are only available in the editor when I bind an expression to a component's attribute. If I directly start a #{} expression on a Facelet and try to auto complete, then no implicit objects show up at all.
Duplicate tag suggestions
When I try to auto complete tags, the editor shows me a lot of duplicate suggestions:
As can be seen, basically every suggestion appears twice. When I first restarted Eclipse after the initial installation of JBoss Tools Visual Editor (Richfaces), I even saw the same ones appearing 3 times. This is not the end of the world, but it does look a little awkward.
I hope this feedback will be valuable to you