Hello.
I'm currently building my first JSF 2 application and I have some questions regarding flow of data between views.
Background
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: Competence.xhtml, EditCompetence.xhtml and EditCompetenceArea.xhtml. These are backed up by a ManagedBean, AdminCompetenceController.
Competence.xhtml 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 EditCompetence.xhtml and EditCompetenceArea.xhtml respectivly, where the user can fill in information about a Competence or and Area.
Questions
What is the recommended way to handle flow of information between these pages? For example: EditCompetenceArea.xhtml 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.
Is it possible to use viewParam to transfer information between views using different backing beans?
- 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.
Also, if anyone can recommend any reading material (preferably free, online) regarding more general design patterns rather than specific smaller problems in JSF 2, I would really appreciate it.