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jYW4gZG8gZmllbGRbaW5kZXhdLCBidXQgSSBjYW4ndCBzZWUgaWYg dGhlIHNhbWUgaXMgcG9zc2libGUgaW4NCglTcHJpbmcuICBJIHNlZSBCZWFuV3JhcHBlci5nZXRJ bmRleGVkUHJvcGVydHlWYWx1ZSgpICwgYnV0IG5vIHNldCgpDQoJZXF1aXZhbGVudC4NCgkNCgkN CglNYW55IHRoYW5rcywNCgkNCglNaWtlLg0KCQ0KCQ0KCQ0KCQ0KCS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCglUaGlzIFNGLm5ldCBlbWFp bCBpcyBzcG9uc29yZWQgYnk6IFRoZSBTRi5uZXQgRG9uYXRpb24gUHJvZ3JhbS4NCglEbyB5b3Ug bGlrZSB3aGF0IFNvdXJjZUZvcmdlLm5ldCBpcyBkb2luZyBmb3IgdGhlIE9wZW4NCglTb3VyY2Ug Q29tbXVuaXR5PyAgTWFrZSBhIGNvbnRyaWJ1dGlvbiwgYW5kIGhlbHAgdXMgYWRkIG5ldw0KCWZl YXR1cmVzIGFuZCBmdW5jdGlvbmFsaXR5LiBDbGljayBoZXJlOiBodHRwOi8vc291cmNlZm9yZ2Uu bmV0L2RvbmF0ZS8NCglfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fXw0KCVNwcmluZ2ZyYW1ld29yay1kZXZlbG9wZXIgbWFpbGluZyBsaXN0DQoJU3ByaW5nZnJh bWV3b3JrLWRldmVsb3BlckBsaXN0cy5zb3VyY2Vmb3JnZS5uZXQNCglodHRwczovL2xpc3RzLnNv dXJjZWZvcmdlLm5ldC9saXN0cy9saXN0aW5mby9zcHJpbmdmcmFtZXdvcmstZGV2ZWxvcGVyDQoJ DQoNCg== |
|
From: Rod J. <rod...@in...> - 2003-10-25 15:20:48
|
Juergen, I think we should provide indexed property support for M3. I think you were right to remove the inadequate support for now. I think supporting the Commons syntax makes sense. I think at one point I envisaged having an IndexedPropertyValue class, but that's probably unnecessary. Regards, Rod -----Original Message----- From: jürgen höller [werk3AT] Sent: Thursday, October 23, 2003 4:50 PM To: spr...@li... Subject: FW: [springframework - Help] Index properties in forms Everybody, Seems like we've got two people inquiring for indexed property support. The second already dates back to mid-September :-( I've just rechecked the BeanWrapper implementation and discovered that there is no proper support for indexed properties yet. The existing getIndexedProperty method was not complete (e.g. no support for nesting) and untested (no unit test covered it), so I've decided to remove it for the time being (for 1.0 M2). It just confused both of those guys that were looking for indexed property support. Jakarta Commons BeanUtils does support nested and mapped properties, quoting from the javadocs of their PropertyUtils class: <quote> For the purposes of this class, five formats for referencing a particular property value of a bean are defined, with the layout of an identifying String in parentheses: * Simple (name) - The specified name identifies an individual property of a particular JavaBean. The name of the actual getter or setter method to be used is determined using standard JavaBeans instrospection, so that (unless overridden by a BeanInfo class, a property named "xyz" will have a getter method named getXyz() or (for boolean properties only) isXyz(), and a setter method named setXyz(). * Nested (name1.name2.name3) The first name element is used to select a property getter, as for simple references above. The object returned for this property is then consulted, using the same approach, for a property getter for a property named name2, and so on. The property value that is ultimately retrieved or modified is the one identified by the last name element. * Indexed (name[index]) - The underlying property value is assumed to be an array, or this JavaBean is assumed to have indexed property getter and setter methods. The appropriate (zero-relative) entry in the array is selected. List objects are now also supported for read/write. You simply need to define a getter that returns the List * Mapped (name(key)) - The JavaBean is assumed to have an property getter and setter methods with an additional attribute of type java.lang.String. * Combined (name1.name2[index].name3(key)) - Combining mapped, nested, and indexed references is also supported </quote> The question is: When and how to we add support for indexed and mapped properties? I guess that if we do, we should adopt the Commons BeanUtils style of specifying property paths for index and map access. This means that we wouldn't need additional methods in the BeanWrapper interface but rather just support for respective property paths in the BeanWrapperImpl implementation. Any thoughts on this? I've completely forgotten about these things in face of all the enterprise stuff we've been addressing lately ;-) Juergen https://sourceforge.net/forum/message.php?msg_id=2251775 By: breidenr I am using a SimpleFormController to help create an object using an HTTP form. Obviously, if my form object is a Vendor, that object has a setName(String) method, and my HTTP form has a field named "name", the Controller will try call Vendor.setName(String) and pass in the value from the form. This also goes for nested properties: address.setCity -> vendor.getAddress().setCity(String). My question is, is there any support for *indexed* properties? By that, I mean purchaseOrder[0].number -> ( (PurchaseOrder) vendor.getPurchaseOrders().get(0)).setNumber(). I know that some expression languages support something like this. IIRC, Struts has something like this, but it has a little kludgy. From what I can tell, nested porperies are supported by the Spring BeanWrapperImpl, but that is it. If this is correct and I want to implement nested properties, any suggestion as to the best route. Thanks. Ryan Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=2193984 By: hogie Hi, If I have a command object that stores a collection and I want the data binder to populate that collection from the servlet request, how should I name the parameters in my servlet request? In Struts I can do field[index], but I can't see if the same is possible in Spring. I see BeanWrapper.getIndexedPropertyValue() , but no set() equivalent. Many thanks, Mike. |
|
From: Colin S. <col...@ex...> - 2003-10-30 17:09:05
|
Depending on how the expression language is implemented (or rather, what syntax the expression language has), I think there is a bit of a potential conflict with PropertyOverrideConfigurer and PropertyPlaceHolderConfigurer, so this is one area that maybe has to be thought about. I think I wrote about this before, but my other suggestion is to make the impl. pluggable, with a namespace prefix to indicate which impl. to actually use, e.g. "ognl:bean1.bean2['key']" would use the ognl impl. Lack of a prefix would default to something. I would suggest that one good approach is to go pluggable like this, but have only a basic implementation in Spring, which wouldn't add much to the size of Spring, and then people could add in support for other expression languages if they wanted to. I would probably add OGNL for example, since I think its great. OGNL btw is at: http://www.ognl.org http://www.ognl.org/2.6.3/Documentation/html/UsersGuide.html. Regards, Colin jürgen höller [werk3AT] wrote: >FYI, we've now got actual requirements for indexed properties in a werk3AT product -- to be implemented by the end of next week. So I'm gonna work on it early next week, suggestions and help are welcome of course. It shouldn't be too hard to do even if fully implemented on our own; the harder part is to settle on a certain syntax. > >Juergen > > > -----Ursprüngliche Nachricht----- > Von: Rod Johnson [mailto:rod...@in...] > Gesendet: Do 23.10.2003 17:32 > An: jürgen höller [werk3AT] > Cc: spr...@li... > Betreff: [Springframework-developer] Re: [springframework - Help] Index properties in forms > > > > Juergen, > > I think we should provide indexed property support for M3. I think you were > right to remove the inadequate support for now. > > I think supporting the Commons syntax makes sense. I think at one point I > envisaged having an IndexedPropertyValue class, but that's probably > unnecessary. > > Regards, > Rod > > -----Original Message----- > From: jürgen höller [werk3AT] > Sent: Thursday, October 23, 2003 4:50 PM > To: spr...@li... > Subject: FW: [springframework - Help] Index properties in forms > > > Everybody, > > Seems like we've got two people inquiring for indexed property support. The > second already dates back to mid-September :-( > > I've just rechecked the BeanWrapper implementation and discovered that there > is no proper support for indexed properties yet. The existing > getIndexedProperty method was not complete (e.g. no support for nesting) and > untested (no unit test covered it), so I've decided to remove it for the > time being (for 1.0 M2). It just confused both of those guys that were > looking for indexed property support. > > Jakarta Commons BeanUtils does support nested and mapped properties, quoting > from the javadocs of their PropertyUtils class: > > <quote> > For the purposes of this class, five formats for referencing a particular > property value of a bean are defined, with the layout of an identifying > String in parentheses: > > * Simple (name) - The specified name identifies an individual property of a > particular JavaBean. The name of the actual getter or setter method to be > used is determined using standard JavaBeans instrospection, so that (unless > overridden by a BeanInfo class, a property named "xyz" will have a getter > method named getXyz() or (for boolean properties only) isXyz(), and a setter > method named setXyz(). > > * Nested (name1.name2.name3) The first name element is used to select a > property getter, as for simple references above. The object returned for > this property is then consulted, using the same approach, for a property > getter for a property named name2, and so on. The property value that is > ultimately retrieved or modified is the one identified by the last name > element. > > * Indexed (name[index]) - The underlying property value is assumed to be an > array, or this JavaBean is assumed to have indexed property getter and > setter methods. The appropriate (zero-relative) entry in the array is > selected. List objects are now also supported for read/write. You simply > need to define a getter that returns the List > > * Mapped (name(key)) - The JavaBean is assumed to have an property getter > and setter methods with an additional attribute of type java.lang.String. > > * Combined (name1.name2[index].name3(key)) - Combining mapped, nested, and > indexed references is also supported > </quote> > > The question is: When and how to we add support for indexed and mapped > properties? I guess that if we do, we should adopt the Commons BeanUtils > style of specifying property paths for index and map access. This means that > we wouldn't need additional methods in the BeanWrapper interface but rather > just support for respective property paths in the BeanWrapperImpl > implementation. > > Any thoughts on this? I've completely forgotten about these things in face > of all the enterprise stuff we've been addressing lately ;-) > > Juergen > > > https://sourceforge.net/forum/message.php?msg_id=2251775 > By: breidenr > > I am using a SimpleFormController to help create an object using an HTTP > form. > Obviously, if my form object is a Vendor, that object has a setName(String) > method, and my HTTP form has a field named "name", the Controller will try > call > Vendor.setName(String) and pass in the value from the form. This also goes > for > nested properties: address.setCity -> vendor.getAddress().setCity(String). > > My question is, is there any support for *indexed* properties? By that, I > mean > purchaseOrder[0].number -> ( (PurchaseOrder) > vendor.getPurchaseOrders().get(0)).setNumber(). I know that some expression > languages support something like this. IIRC, Struts has something like this, > but it has a little kludgy. > > From what I can tell, nested porperies are supported by the Spring > BeanWrapperImpl, > but that is it. If this is correct and I want to implement nested > properties, > any suggestion as to the best route. > > Thanks. > > Ryan > > > > Read and respond to this message at: > https://sourceforge.net/forum/message.php?msg_id=2193984 > By: hogie > > Hi, > > > > If I have a command object that stores a collection and I want the data > binder > to populate that collection from the servlet request, how should I name the > parameters in my servlet request? > > > In Struts I can do field[index], but I can't see if the same is possible in > Spring. I see BeanWrapper.getIndexedPropertyValue() , but no set() > equivalent. > > > Many thanks, > > Mike. > > |
|
From: Rod J. <rod...@in...> - 2003-10-30 17:36:25
|
> I would suggest that one good approach is to go pluggable like this, but > have only a basic implementation in Spring, which wouldn't add much to > the size of Spring, and then people could add in support for other > expression languages if they wanted to. I would probably add OGNL for > example, since I think its great. +1 |