Hi Michael,

I run in the same issue days ago. I could not find a proper solution for 
Struts 1.0.*. The right answer, I think is using String[] as type of data in 
ActionForms. By instance, you can wrap all HTML inputs (<html:text 
property="inputs[1]">) in a unique parameter:

String[] inputs with get and set methods in handling the String[]. In the 
JSP, you set property as equals input[1], input[2].... for the different 
inputs. The same could be applied for checkboxes, radios, or selects.

- In Struts 1.1b1, if you set a breakpoint at validate() method in 
ActionForm, by instance, you will find the parameter input filled with 
values collected from the JSP, so you can process them. Same applies for the 
selects, radios and checkboxes. This behaviour does not seems to work in 
Struts 1.0.*, I guess that by some bug in fetching indexed property values.

- Either in Struts 1.0.* or 1.1b1, if you preset the String[] with values, 
JSP will show them when displayed.

I have not test it, by I suppose you can use DynaActionForms and define 
String[] in the struts-config....

Hope it helps.

Adolfo

>From: "Michael Marrotte" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Subject: Dynamic Forms?
>Date: Wed, 15 May 2002 08:07:18 -0700
>
>I need help figuring out how to generate and use dynamic forms with Struts.
>
>Is there already an eloquent MVC solution in Struts?
>
>Is DynaActionForm the answer?
>
>I can't see how extending the ActionForm behavior accomplishes this.  It
>seems that to really implement a dynamic form, the form Bean would need to
>be defined and instantiated at run-time, based on the HttpResponse 
>generated
>by the forms JSP.
>
>For example:
>
>Say the JSP for looks like the following:
>
><%-- myDynamic.jsp --%>
><html:form action="/work">
>
><logic:iterate id="y" name="a" property="b"/>
><html:text>
>       property="x-"<bean:write name="y" property="z"/>
></html:text>
></logic:iterate>
>
></html:form>
>
>This will not work since "property" is required in the <html:text> tag.
>However, if it did work, then it seems there would need to be some Action
>that gets the HttpResponse from "myDynamic.jsp" and generates the source
>(Java) form definition, e.g.:
>
>// MyDynamicAction.java
>...
>
>for(Iterator i = A.iterator(); i.hasNext;)
>  a = i.next();
>  buffer.append("public setX-" +  a.getB() + "(String s) { ");
>  buffer.append("  x-" + a.getB() + " = s ;");
>
>...
>
>And, then compiles and instantiates it.
>
>Does this make any sense, whatsoever?  If I'm completely lost, then someone
>please try and help point me in the right direction.
>
>Thanks,
>
>--Michael Marrotte
>
>
>--
>To unsubscribe, e-mail:   
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>
>


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to