title: Difference between value and binding
body: <p>What is the difference between using value and binding with JavaServer Faces, and when would you use one as opposed to the other?  To make it clearer what my question is, a couple of simple examples are given here.</p>
  
  <p>Normally with JSF in the XHTML code you would use "value" as here:</p>
  
  <pre><code>&lt;h:form&gt; 
    &lt;h:inputText value="#{hello.inputText}"/&gt;
    &lt;h:commandButton value="Click Me!" action="#{hello.action}"/&gt;
    &lt;h:outputText value="#{hello.outputText}"/&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>Then the bean is:</p>
  
  <pre><code>// Imports
  @ManagedBean(name="hello")
  @RequestScoped
  public class Hello implements Serializable {
  
  private String inputText;
  private String outputText;
  
  public void setInputText(String inputText) {
      this.inputText = inputText;
  }
  
  public String getInputText() {
      return inputText;
  }
  
  // Other getters and setters etc.
  
  // Other methods etc.
  
  public String action() {
  
      // Do other things
  
      return "success";
  }
  }
  </code></pre>
  
  <p>However, when using "binding", the XHTML code is:</p>
  
  <pre><code>&lt;h:form&gt; 
    &lt;h:inputText binding="#{backing_hello.inputText}"/&gt;
    &lt;h:commandButton value="Click Me!" action="#{backing_hello.action}"/&gt;
    &lt;h:outputText value="Hello!" binding="#{backing_hello.outputText}"/&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>and the correspondibg bean is called a backing bean, and is here:</p>
  
  <pre><code>// Imports
  @ManagedBean(name="backing_hello")
  @RequestScoped
  public class Hello implements Serializable {
  
  private HtmlInputText inputText;
  private HtmlOutputText outputText;
  
  public void setInputText(HtmlInputText inputText) {
      this.inputText = inputText;
  }
  
  public HtmlInputText getInputText() {
      return inputText;
  }
  
  // Other getters and setters etc.
  
  // Other methods etc.
  
  public String action() {
  
      // Do other things
  
      return "success";
  }
  }
  </code></pre>
  
  <p>What practical differences are there between the two systems, and when would you use a backing bean rather than a regular bean?  Is it possible to use both?</p>
  
  <p>I have been confused about this for some time, and would most appreciate having this cleared up.</p>