1 Reply Latest reply on Jan 29, 2011 1:31 PM by Alexey Kazakov

    JSF 2.0 and other issues in Visual Editor

    henk de boer Master

      When 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;
      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"
            <h:outputText value="#{myBean.foo}" />  


      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

        • 1. JSF 2.0 and other issues in Visual Editor
          Alexey Kazakov Master

          EL methods with parameters

          This is a bug of Eclipse WTP JST Tools. You can disable Eclipse facet validator in Windows->Preferences->Validation->Facelet HTML Validator.

          Annotated managed beans

          Unfortunately, JBoss Tools still doesn't support annotated managed beans. See https://issues.jboss.org/browse/JBIDE-5045

          Implicit EL Objects

          JBoss Tools doesn't provides code completion (and navigation) for implicit EL objects. This functionality came from Eclipse WTP JSF Tools. And I agree that it has mentioned bugs. Anyway please feel free to create a feature request in https://issues.jboss.org/browse/JBIDE against JBoss Tools. It seems that we should start covering this too to avoid WTP's bugs.

          Duplicate tag suggestions

          Looks like a bug but I can't reproduce it. Could you create an issue in JIRA and describe the steps to reproduce it.

          I hope this feedback will be valuable to you

          Thank you for the feedback!