title: JSF Lifecycle and Custom components
body: <p>There are a couple of things that I am having a difficult time understanding with regards to developing custom components in JSF.  For the purposes of these questions, you can assume that all of the custom controls are using valuebindings/expressions (not literal bindings), but I'm interested in explanations on them as well.</p>
  
  <ol>
  <li>Where do I set the value for the valuebinding?  Is this supposed to happen in decode?  Or should decode do something else and then have the value set in encodeBegin?</li>
  <li>Read from the Value Binding - When do I read data from the valuebinding vs. reading it from submittedvalue and putting it into the valuebinding?  </li>
  <li>When are action listeners on forms called in relation to all of this?  The JSF lifecycle pages all mention events happening at various steps, but its not completely clear to me when just a simple listener for a commandbutton is being called</li>
  </ol>
  
  <p>I've tried a few combinations, but always end up with hard to find bugs that I believe are coming from basic misunderstandings of the event lifecycle.</p>