As far as I can determine, it is not possible to create a DynaActionForm
which has a property of type Map. It is also not possible to extend it to
be able to accept a property of type Map. This seems like an unfortunate
omission, so I'd like to fix it. First, though, I'd like to get some
feedback on whether there is a reason it's not currently supported, and on
the best way of resolving it.

Some context:

I need to be able to use the following in my JSP page:

  <input type="hidden" name="rts(prop)" value="foo">

Hence, my form bean needs to have a property named 'rts' which is a Map,
which will ultimately contain an entry with key 'prop' and value 'foo'.

I tried a number of things before ultimately realising that this can't be
done currently. (Someone please correct me if I'm wrong!) They were:

1) Specify the property as of type "java.util.HashMap". This alone doesn't
work because there is no map initially created.

2) Add an 'initial' attribute, and configure a dummy converter to create
the HashMap. This "works", except that the value of the 'prop' entry in
the map is itself a Map, and not 'foo'. I'm baffled as to why that
happens, but it does. It's probably a bug that needs fixing somewhere, but
right now I don't know where.

3) I tried extending DynaActionForm per a message from Craig to
struts-user, but that does not work. There is no way to add properties in
a derived class, because new descriptors cannot be added. The problem is
that a change would be required in DynaActionFormClass as well, but the
use of that class is hardcoded in a number of places, so any extension
would not be picked up.

Regardless of the type of the property to be added, (3) seems to indicate
a fairly serious shortcoming in the DynaActionForm infrastructure - that
properties cannot be added in subclasses.

Does anyone have any insight on why this is the way it is, and how best to
rectify the issues identified in (2) and (3)?

--
Martin Cooper



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to