I'd like to use DHTML to allow the user to add new elements to add new elements to the form from the client side. Personally, I avoid doing this precisely because of the situation you are facing. That said, there are a few opitons:
1. Don't do it. Every time they "add" a new element your app would call an action that would do something like add a new empty object to your model's collection, then assemble the form based on the current state of the model. When you redisplay back to the user, he now has his blank element he can fill in and you have a one-to-one mapping of collection objects with your model. This is my preferred method.
2. Don't use an ActionForm. Have your Action (or a helper object used by the Action) parse through the request manually and decide how to populate your model. This one's pretty ugly imho and I'd avoid it.
3. Extend RequestProcessor and override processPopulate(). Examine the request and manipulate your ActionForm's collections as needed. Again, not my preferred option, hard to do generically so that it handles all ActionForms (say hello to my friend the
Java Reflection API), but it is an opiton.
4. A combination of #3 along with having your ActionForms implement an interface which would make it easier for the RequestProcessor to modify your collections, but delegating the specifics to the ActionForm. For example maybe give your ActionForms a method name like addToCollection(
String collectionName). Still, I don't particularly care for this option either.
Personally, I'd strongly advocate option 1.