The problem here is that with 5 login forms.. How would you know or even care which of the 5 was used to submit? Is it processed differently if I pick m of n versus x of n? In any case sounds like what you really want is the same form and the same action. Ie..
I might have a bean such that it only contains one parameter. (don't mind syntax as stupid outlook keeps trying to apply spelling and grammer rules which I don't want to turn off cause I'm the worst speller/grammulator) <form-bean name="loginForm" type="org.apache.struts.validator.DynaValidatorForm"> <form-property name="formIteration" type="java.lang.Integer"/> </form-bean> This bean is mapped to the same action. (ex. /loginAction) Then for my JSP : //remember n is simulated ie. don't put n in end (duh) :) <c:forEach var="loopCnt" begin="1" end="n"> <html:form action="/loginAction"> <html-el:hidden property="formIteration" value="${loopCnt}"/> <html:submit property="userAction"> <bean:message key="button.login"/> </html:submit> </html:form> </c:forEach> Now your action is pretty simple. Based on the formIteration value you know which of the n forms was used to login. Hope that helps. -Tim -----Original Message----- From: Sonam Belbase [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 6:37 PM To: Struts Users Mailing List Subject: Re: please help: ActionForms of same type but different name? There is no knowing until runtime how many iterations there are going to be. That's why we can't define the n number of LoginForms. The requirement is that on the same jsp, we will have repeating <html:form></html:form> sections. User will specify at runtime how many he/she wants. The <html:forms> will all be of the same type. Restriction is that only one can be submitted at a time, i.e. user might have specified 5 Login sections of the page, and therefore is shown 5 login sections, but can only "save" one at a time. The "save" action needs to know which form to retrieve the values "username" and password" from. SB "Chen, Gin" wrote: > One approach, you can define as many form-beans as you want iteratations. > Ex: > <form-bean name="LoginForm_1" > type="com.oreilly.struts.storefront.security.LoginForm"> > </form-bean> > <form-bean name="LoginForm_2" > type="com.oreilly.struts.storefront.security.LoginForm"> > </form-bean> > . > . > . > <form-bean name="LoginForm_n" > type="com.oreilly.struts.storefront.security.LoginForm"> > </form-bean> > > You can also just use a single form bean for all your actions.. If they are > the same class then they are the same formbean anyways. > So just use the same name for all of them (well not html:form name in Struts > 1.1+ but rather use name in action definition). > Or If you explain your requirements a bit more we could come up with a > better solution/explanation. > -Tim > > -----Original Message----- > From: Sonam Belbase [mailto:[EMAIL PROTECTED] > Sent: Monday, October 27, 2003 6:16 PM > To: Struts Users Mailing List > Subject: please help: ActionForms of same type but different name? > > Given the following code in my jsp: > > <logic:iterate id="element" name="dynamicFormList" > type="java.lang.String" > > <html:form action="/login" name="<%=element%>" > type="com.oreilly.struts.storefront.security.LoginForm"> > > User Name: > <html:text property="userName" size="20" maxlength="50"/> > Password: > <html:text property="password" size="20" maxlength="50"/> > <html:hidden property="identifier" value="<%= element %>" /> > <html:submit property="" value="OK" /> > > </html:form> > </logic:iterate> > > element has the value "LoginForm_1" in the first iteratation, > "LoginForm_2" in the second iteration, and so on. > > In struts-config: > <form-bean name="LoginForm" > type="com.oreilly.struts.storefront.security.LoginForm"> > </form-bean> > > LoginForm extends ActionForm. > > I understand that the attributes "name" and "type" have been deprecated > but I am trying to get the iteration to create and display a new > instance of the LoginForm, each with it's own name and properties. After > submit, the request processor seems to look for a formbean associated > with the action (in this case, a formbean called "LoginForm") and not a > formbean with name "LoginForm_1" and therefore in the action the form > property values are all null. > > Anyone know how I can get it to look for the formBean with the unique > name that was specified by the variable element? > > Thanks, > SB > > -- > NOTICE: If received in error, please destroy and notify sender. Sender > does not waive confidentiality or privilege, and use is prohibited. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]