I have a persistent bean (Hibernate) called Student, I need to have a view (Facelet) which has 2 parts:
- first part contains a form for inserting new students 开发者_开发技巧
- second part shows list of all students in a
the form has one button for inserting the new student, after clicking the button if the new student is created successfully, the form show the current student data and user can edit it and click the button again to update the student. After the insertion another button (New) should appear and if the user click it, the form will reset and he/she can insert another student.
in the grid(<dataTable>) user can click on any of students and have it in the form in order to update the student.
I have to use a JSF bean which is RequestScope or at most ViewScoped (Not application or session scope)
Can you give me some explanation, best practices or any other point to implement it. By the way I'm using GlassFish but I have to use JSF beans, not CDI beans.
A @ViewScoped
bean is the best suit. You can find a kickoff example in this article.
精彩评论