开发者

Some Insert/Edit scenario in JSF

开发者 https://www.devze.com 2023-02-03 07:08 出处:网络
I have a persistent bean (Hibernate) called Student, I need to have a view (Facelet) which has 2 parts:

I have a persistent bean (Hibernate) called Student, I need to have a view (Facelet) which has 2 parts:

  1. first part contains a form for inserting new students
  2. 开发者_开发技巧
  3. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消