|
From: William G. T. Jr. <wg...@ru...> - 2003-07-07 20:28:01
|
jürgen höller [werk3AT] wrote: > Hi Rhandy, > > For multiple form objects, you could use custom objects that you bind parameters onto via BindUtils and put in the session as some custom attribute. I consider it preferable to use a different strategy though: Not a map, but a custom root object that contains the form objects as bean properties, like a MyRootObject class with getMyFirstObject and getMySecondFormObject methods. It's easy to bind to the contained objects via nested properties, e.g. "myFirstFormObject.myProperty" and "mySecondFormObject.myOtherProperty". > > Regarding a list of objects, it's probably indeed the best way to parse respective request parameters manually, in a custom onBindAndValidate implementation. Especially if you want to add and remove elements, I can't think of a different way. We could try to bind to an existing list of objects, but it's not too obvious how to go about this (via an index? what if it's a Set, Collection, or Map), so we don't support this yet. If you have an idea how to achieve this, please let me know :-) There might be something we could borrow from the Japple framework. Don't know if this the most elegant solution, but it works. The Japple framework supports something like this for a Collection of objects by maintaining an internal "sequence" for each object and a hidden "queryString" which is used to provide hints to the binding mechanism. http://www.japple.org/tutorial/complex_objects.html Bill > > Regards, > Juergen > > > -----Original Message----- > From: Rhandy Lado [mailto:rh...@do...] > Sent: Monday, July 07, 2003 10:49 AM > To: jürgen höller [werk3AT] > Subject: [Springframework] Request Binding > > > Hi Jurgen, > > I've been using the FormController classes in a few webpages now and > found that I sometimes need to work with more than one form object. How > do I return more than two objects and bind each of them in the webpage? > Should I put each object in a Map and then return the map? If so, how do > you access the map using the <i21:bind> tags? > > Also, I have a list defined in my form object. Do the <i21:bind> tags > support binding data to a list? If not, do you have any suggestions on > how I may go about this? (I was initially thinking of passing back a > series of request parameters and manually adding these values to the > form object list but I have a feeling there is a more elegant way of > doing this.) > > Thanks in advance, > Rhandy > > |