title: Calling methods from JSF page doubts
body: <p>I have a couple of questions about the way I call methods in EL. Maybe someone could explain how it actually works.</p>
  
  <p>I did this very simple example:</p>
  
  <p><strong>index.xhtml</strong></p>
  
  <pre><code>&lt;h:body&gt;
  &lt;!-- Using a method --&gt;
  #{bba.salute()}
  &lt;br/&gt;
  &lt;h:outputText value="#{bba.salute()}"/&gt;
  &lt;br/&gt;
  &lt;!-- Using a method from an injected bean--&gt;
   #{bba.b.doSomething()} 
  &lt;/h:body&gt;
  </code></pre>
  
  <p><strong>BackBeanA.java</strong></p>
  
  <pre><code>@Named("bba")
  @SessionScoped
  public class BackBeanA implements Serializable {
  
      private static final long serialVersionUID = 5671761649767605303L;
      @Inject
      private BackBeanB b;
  
      public String salute() {
          return "Hi! I am 'A'";
      }
  
      public BackBeanB getB() {
          return b;
      }
  
      public void setB(BackBeanB b) {
          this.b = b;
      }   
  }
  </code></pre>
  
  <p><strong>BackBeanB.java</strong></p>
  
  <pre><code>@Named("bbb")
  @SessionScoped
  public class BackBeanB implements Serializable {
  
      private static final long serialVersionUID = -4786092545430477941L;
  
      public String doSomething() {
          System.out.println("Hello!!!");
          return "I am a SessionScopped Backing Bean, my name is 'B' and i am doing something";
      }
  }
  </code></pre>
  
  <p>This are the questions I have:</p>
  
  <ol>
  <li><p>When I call a method from a backing bean, when do I need to use the brackets (), and when I don't need? Example: If I remove the brackets from <code>#{bba.salute()}</code>, I get an error, that says(Cannot find a property called 'salute')</p></li>
  <li><p>I also want to learn how to call a method from an injected bean. I injected BackBeanB, inside BackBeanA, but when I say <code>#{bba.salute()}</code> in the page, I don't see the message I from the method in <code>BackBeanB</code>. Why is that? Injected beans don't need to be initialized in <code>@PostConstruct</code> right? Are the getters and setters for the injected bean enough?</p></li>
  <li><p>Note the line where I say <code>&lt;h:outputText value="#{bba.salute()}"/&gt;</code>, it works, but eclipse displays a warning like this:</p>
  
  <p><img src="https://i.stack.imgur.com/30oTX.png" alt="enter image description here"></p>
  
  <p>Why is that?</p></li>
  </ol>