title: Data flow between views in JSF 2
body: <p>I'm currently building my first JSF 2 application and I have some questions regarding flow of data between views.</p>
  
  <p><strong>Background</strong></p>
  
  <p>The application keeps track of competences of IT-consultants. To illustrate my questions, I will just describe a small part of it. A Competence entity has a many-to-one relation to a Area entity, putting the different competences in groups. I have views to handle these: <em>Competence.xhtml</em>, <em>EditCompetence.xhtml</em> and <em>EditCompetenceArea.xhtml</em>. These are backed up by a ManagedBean, <em>AdminCompetenceController</em>. </p>
  
  <p><em>Competence.xhtml</em> lists all Areas in a table, and lists all Competences in an Area if the user clicks on its row. It also has a new-button for Competences and Areas, and an Edit-button for each Competence and Area. these leads to <em>EditCompetence.xhtml</em> and <em>EditCompetenceArea.xhtml</em> respectivly, where the user can fill in information about a Competence or and Area.</p>
  
  <p><strong>Questions</strong></p>
  
  <ul>
  <li><p>What is the recommended way to handle flow of information between these pages? For example: <em>EditCompetenceArea.xhtml</em> needs to know which Area it should edit (or if it should make a new one). Should I have one backing bean per view or one for all of them? Should it be Session scoped and keep track of the selected Area/Competence with variables? Or should it be View scoped and send the id of the selected object with viewParams? Is it even possible to use Request scope? I've tried several of these and have run into practical problems with each method.</p></li>
  <li><p>Is it possible to use viewParam to transfer information between views using different backing beans?</p></li>
  <li>Is it possible to use viewParam with a Request scoped backing bean? The data seems to disappear from the bean before I can use it in the postback.</li>
  </ul>
  
  <p>Also, if anyone can recommend any reading material (preferably free, online) regarding more general design patterns rather than specific smaller problems in <strong>JSF 2</strong>, I would really appreciate it.</p>