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]

Reply via email to