Stéphane Zuckerman wrote:
I found myself faced with the same question recently, and couldn't
figure out a solution. The 'obvious' solution was to use Map-typed
properties in my DynaActionForm declaration, but that didn't work :-(
What was the problem ? I have used map-typed properties (which, by the
way, prevents me from using the validator plugin correctly on these
properties, since I never really know how many {key,value} couples I'll
have), and ran into several problems, but in the end, there are two
It's been a while, I can't remember exactly. Something to do with either
not being able to access members of the map in the JSP, or not being able
to populate them on form submission. I'd have to search the archives for my
original posts to check :)
solutions I can think of :
1/ Use a session-scoped form (I think this is bad design, but sometimes,
it does comes handy).
I'm not sure how that would help. I try to putting things in the session as
much as possible, anyway.
2/ Use a LazyMap (just as you would use a LazyList ;-) ).
I can't remember if I looked at lazy maps/lists at the time or not now.
The problem is always the same with "classical" maps (and it is the same
for the lists) :
You have a request-scoped object (a map/a list), which is initialized
when loading the JSP and sending the result to the client. But when the
latter submits his/her form, the entries in said object aren't initialized.
for instance, if you have a text field such as :
<html:text property="propMap('hello')"/>
The 'hello' key might have existed in the past, but since this is a new
request, it does not any more.
It shouldn't be a problem if the key doesn't exist, any more than it should
be a problem if a scalar field isn't filled in. The action you submit to
should treat a missing key in the map the same as any other missing field.
You should look at
http://www.niallp.pwp.blueyonder.co.uk/lazyactionform.html for more
information...
I'll take a look at that, thanks.
--
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/laurie
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]