|
From: Alef A. \(JTeam\) <al...@jt...> - 2003-09-03 20:38:39
|
Any luck yet? I'm curious alef -----Oorspronkelijk bericht----- Van: spr...@li... [mailto:spr...@li...] Namens Kopylenko, Dmitry Verzonden: Wednesday, September 03, 2003 3:32 PM Aan: 'spr...@li...' Onderwerp: FW: [Springframework-developer] Binding to a Collection To the list... -----Original Message----- From: Alef Arendsen (JTeam) [mailto:al...@jt...] Sent: Wednesday, September 03, 2003 9:28 AM To: 'Kopylenko, Dmitry' Subject: RE: [Springframework-developer] Binding to a Collection There was a message on the forum a long time ago (http://sourceforge.net/forum/message.php?msg_id=1997848) where someone was asking the same thing. Anybody, please correct me if I'm wrong, but I don't believe this is possible using the current ServletRequestDataBinder and BaseCommandController. To support lists in combination with PropertyEditors, I once used a ListDataBinder (extending ServletRequestDataBinder). With this databinder it is possible to iterate over the objects in the list and rendering fields/properties using the propertyeditors that are registered... Quite straightforward. However, this only does the rendering of properties using propertyeditors. How to do binding, I don't know (yet). I'll attach the source of the ListDataBinder, which is to instantiated in a AbstractListController. The fetchList-method in the ListController class, atcually fetches the list (which is used in the ListDataBinder)... Example of usage: <!-- the iterator from the ListDataBinder exposes the command object --> <c:forEach items="binder-command-attribute-whatever" item="bla"> <!-- the bind tag binds editors and values and stuff for the current element in the collection --> <spring:bind path="propertyToRender"> <:out value="${status.value}"/> </spring:bind> </c:forEach> have to go... I'll get back to you later... cheers, Alef -----Oorspronkelijk bericht----- Van: spr...@li... [mailto:spr...@li...] Namens Kopylenko, Dmitry Verzonden: Wednesday, September 03, 2003 2:37 PM Aan: 'spr...@li...' Onderwerp: [Springframework-developer] Binding to a Collection Hi everybody. I have one question, if any one has a quick answer :-) What would be the best way to "bind" html data into a collection of objects? Let's say I have an html table in the form, each row representing a model/command object. When submitting this form to a Controller, I would like to bind the values from the html table into a Collection of model/command objects. What would be the best way to do that? Thanks, Dmitriy. P.S. I believe there was a message about this issue on the list, but I'm to lazy to search for it ;-) |