Here is my Controller
As you can see, I have overridden the postProcessPage to handle the addDBA request in the wizard.Code:public class NewCustomerWizardController extends AbstractWizardFormController { private static final Log log = LogFactory.getLog(NewCustomerWizardController.class); public NewCustomerWizardController() { this.setAllowDirtyBack(true); this.setPages(new String[] { "newcustintro", "newcustprofile", "newcustcontacts", "newcustrefs", "newcustguar", "newcustdocs" }); } @Override protected ModelAndView processFinish(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { return new ModelAndView("redirect:custoverview.htm", "customerId", ((CustomerCommand)command).getId()); } @Override protected ModelAndView processCancel(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { return new ModelAndView(new RedirectView("home.htm")); } @Override protected Object formBackingObject(HttpServletRequest request) throws Exception { CustomerCommand command = new CustomerCommand(); command.setCustomer(new Customer()); return command; } @Override protected Map referenceData(HttpServletRequest request, Object command, Errors errors, int page) throws Exception { Map<String, Object> refData = new HashMap<String, Object>(); refData.put("stateList", DMOperations.getStates()); return refData; } @Override protected boolean suppressValidation(HttpServletRequest request) { if ( (request.getParameter("_addDBA") != null) { return true; } return super.suppressValidation(request); } @Override protected void postProcessPage(HttpServletRequest request, Object _command, Errors errors, int page) throws Exception { //If there is errors during validation, do nothing. if(errors.getErrorCount() >=1) return; CustomerCommand command = (CustomerCommand) _command; if (request.getParameter("_addDBA") != null) { command.addDba(new DBA()); return; } } }
As of now, I'm having the following code in the jsp.
Where the jsp is getting the DBA list from the command. (Thats the reason I'm not using referenceData method to populate the DBAList)Code:<table class="mytable" id="dbaList" summary="DBAS" width="90%"> <caption> <span> Doing Business As </span> <input type="submit" name="_addDBA" value="Add" tabindex="7"> </caption> <tbody id="dbas"> <c:forEach items="${newCustomer.dbas}" var="dba" varStatus="counter"> <tr> <td> <form:input path="dbas[${counter.index}].name" size="40" /> </td> </tr> </c:forEach> </tbody> </table>
From your initial page load answer, can I assume, I can have the code inside table body as it is? If so, will the ajaxAction response will override the content of the body?
On a side note, I'm looking all over the world to have a good solution.
I need exactly same as struts-layout datagrid behavior, where you can add multiple items in a table and save all during submit. They use javascript solution and nicely intergated with struts tag library.
http://struts.application-servers.co...o?reqCode=edit
My other option is to use javascript to add the rows and have to figure out how to bind the values in the command object.
Thanks



