From: "Turley, Michael" <[EMAIL PROTECTED]> > I am looking for a more graceful strategy than creating an > ActionForm with an arbitrary amount of getAccount_<x>/setAccount_<x> methods > to retrieve and act on user submitted data. Any ideas?
I have a page that displays all the accounts that a user is allowed to see. They can check off however many of them they want, then continue to view a report of the activity in those accounts. The Map (List, in your case,) of possible accounts isn't part of the Form, it just gets placed in scope and iterated over with <c:forEach> and <html-el:multibox>. When the form is submitted, the values (the account numbers) for only the checked checkboxes go into a form element that is a String[], and that's what I use in the Action to request the report. The form: <form-bean name="accountForm" type="edu.asu.vpia.struts.AccountForm"> <form-property name="accounts" type="java.lang.String[]"/> ... The JSP: <c:forEach items="${accountMap}" var="item" > <html-el:multibox property="accounts" value="${item.key}"/> <c:out value="${item.key}"/> <c:out value="${item.value.costCenterDesc}"/> </c:forEach> In the Action: String[] accounts = (String[]) dvForm.get( "accounts" ); HTH, -- Wendy Smoak --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]