Hi, I would like some of my pages to have more than one form allocated and therefore passed to the action class for processing. Is this possible without resonable fuss. Are there examples? I would like to have a form class associated with each table and petsistable object. Nice clean design but the front end has pages where updates are made to more that one table. Thanks for any help. David
You would have to use different action mappings. E.g. <action path="action/form1" type="myAction" name="form1" > ... <action path="action/form2" type="myAction" name="form2" > ... Then you'd have to dispatch requests depending on the type of form received. One of the first things you might try would be a series of if statements that tests for specific instanceofs your different forms but this isn't ideal, especially if it's possible that new form types will be added in the future. But then again, DTSTTCPW and YAGNI, so if you can live with it for now... [ April 18, 2003: Message edited by: Junilu Lacar ]
Also, your current design may seem clean and simple at first but making a form correspond to a single table/persistable object is mixing your layers and coupling the wrong ones together. ActionForms should be more tightly coupled to the JSPs that they work with since the form is part of the view layer. Your table is part of the db layer. Your persistable object probably straddles your Model and Persistence layer. The ActionForm should be used to relay information between the View layer and Model layer, not from the View directly to the Persistence layer. Let the Model worry about relaying the information to the appropriate Persistence layer objects.