Why can't you use the Commons BeanUtils MappedProperty feature?
Supposing you have these methods on your bean:
public void setProperty(String key, Object value)
public Object getProperty(String key)
then you can use this notation in the Struts nightly build:
<bean:write name="formBean" property="property(key)"/>
Fr.
-----Original Message-----
From: Stefan Wachter [mailto:[EMAIL PROTECTED]]
Sent: 26 November 2001 12:25
To: [EMAIL PROTECTED]
Subject: proposal for map properties in form beans (call for comments)
Dear all,
I have a lot of form bean classes that store their values in maps. Currenty
I must implement lots of similar getter and setter methods in each form bean
class in order to allow struts to access these values. E.g.
public String getName() {
return (String)myValues.get("name");
}
public void setName(String aString) {
myValues.put("name", aString);
}
My proposal is to enable struts to directly access values in maps. For
example a bean can have a map valued-property "values" (i.e. the method
"public
Map getValues();"). Now I want to access a value in this map exactly as if
it
was a normal property. For example in JSP:
<bean:write name="formBean" property="value.name"/>
The big advantage of this feature would be that I can drive the application
with meta-data. Adding a new property does not need the form beans to be
touched. Even the JSP could be prepared to generate additional fields.
Unfortunately when I scanned the struts sources I found that this kind of
extension is problematic because currently properties are accessed by the
java.beans.ProperyDescriptor instances. I think that the access would have
to be
changed to use reflection directly.
Has someone coments or suggestions on this topic?
Ciao,
Stefan
PS: This mechanism of accessing mapped values is built into the web-objects
framework.
--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
************************************************************************
The information in this email is confidential and is intended solely
for the addressee(s).
Access to this email by anyone else is unauthorised. If you are not
an intended recipient, please notify the sender of this email
immediately. You should not copy, use or disseminate the
information contained in the email.
Any views expressed in this message are those of the individual
sender, except where the sender specifically states them to be
the views of Capco.
http://www.capco.com
***********************************************************************
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>