• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF collection datatable editing

 
Milos Bezindijevic
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
after days spent Googling and forums-browsing I decided to post my question on one of the best Java forums on the web.

I have created JPA-JSF CRUD application using Netbeans, with addition of Richfaces. Everything works great, except I would like to enhance it a bit.

One of the entities - E1 contains among other members a collection - made of another entity - E2.
It is represented on Detail screen of E1 as a table made of rows, each being different E2. User is able to view, edit or delete each row separately by clicking coresponding link next to that row.
I would like to make the whole E2 collection data table editable, so user wouldn't have to go to a different screen everytime in order to edit E2 values.
How can I reference each E2 row separately in E1 controller class and how can I have one unified Save button that would save entered values for the multi-row E2 table on the E1 Detail screen?

Thanks in advance.
 
Sumeet Singh Aryan
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am also facing the same problem.... but still the problem exists... any suggestions??
 
Milos Bezindijevic
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
this link was very helpful:
http://balusc.blogspot.com/2006/06/using-datatables.html
Basicaly, what you have to do is just persist E2 collection iterating through it and calling it's jpa controler's edit method (that persists E2 entities).
You don't have to worry about how to pass values from form to the bean because JSF does it for you, so this->e2Collection called from the E1 controller
holds your newly entered values.
Below action assigned to a button on the E1 details form (that contains E2 collection in datatable with h:inputText fields).



Hope this helps.
Cheers!
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!