|
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. > > |