You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Adrian Cunningham <a....@kainos.com> on 2002/06/20 13:22:08 UTC

Dynamic Forms

Hi,
 
I am writing a JSP that will contain a dynamic form.  It basically
consists of a table in which each row contains various form elements,
the number of rows in the table is variable.  For example:
 
...
 
<%
 for(int i = 0; i < 3; i++)
 {
%>
 
<tr>
 <td>
  <html:text property="sTitle<%= i %>_i" />
 </td>
 <td>
  <html:text property="sForname<%= i %>_i" />
 </td>
 <td>
  <html:text property="sSurname<%= i %>_i" />
 </td>
</tr>

<%
 }
%>
 
As you can see from the example I use a for loop to dynamically create
the rows in the table.  As a result I need to specify unique names for
each of the properites in the form so I also dynamically create the
property names.  For this reason I can't use the ActionForm as it
requires the properties, getters and setters to be defined.
 
I thought the solution to my problem would be DynaActionForm but again
it requires the properties to be specified in the struts-config.xml
file, same problem.
 
So how can I implement dynamic forms using Struts without having to
write the form class and defining all my properties, getters and
setters.
 
Any help on this would be greatly appreciated.
 
Thanks in advance.
 
Adrian Cunningham
 


--

This e-mail is confidential and is intended for the named recipient only. If
you receive it in error please destroy the message and all copies. Kainos
Software Ltd. does not accept liability for damage sustained as a result of
malicious software (e.g. viruses). Kainos does not accept liability for, or
permit; the creation of contracts on its behalf by e-mail, the publication of
any defamatory statement by its employees by e-mail, or changes subsequently
made to the original message. The Company's registered office is located at
4-6 Upper Crescent, Belfast, BT7 1NT, Northern Ireland, Tel +44 28 9057 1100.

Re: Dynamic Forms

Posted by James Holmes <jh...@yahoo.com>.
Check the mailing list archives.  This question was
answered in the past couple of days.

http://www.mail-archive.com/struts-user@jakarta.apache.org

-james
james@jamesholmes.com
http://www.jamesholmes.com/struts/


--- Adrian Cunningham <a....@kainos.com> wrote:
> Hi,
>  
> I am writing a JSP that will contain a dynamic form.
>  It basically
> consists of a table in which each row contains
> various form elements,
> the number of rows in the table is variable.  For
> example:
>  
> ...
>  
> <%
>  for(int i = 0; i < 3; i++)
>  {
> %>
>  
> <tr>
>  <td>
>   <html:text property="sTitle<%= i %>_i" />
>  </td>
>  <td>
>   <html:text property="sForname<%= i %>_i" />
>  </td>
>  <td>
>   <html:text property="sSurname<%= i %>_i" />
>  </td>
> </tr>
> 
> <%
>  }
> %>
>  
> As you can see from the example I use a for loop to
> dynamically create
> the rows in the table.  As a result I need to
> specify unique names for
> each of the properites in the form so I also
> dynamically create the
> property names.  For this reason I can't use the
> ActionForm as it
> requires the properties, getters and setters to be
> defined.
>  
> I thought the solution to my problem would be
> DynaActionForm but again
> it requires the properties to be specified in the
> struts-config.xml
> file, same problem.
>  
> So how can I implement dynamic forms using Struts
> without having to
> write the form class and defining all my properties,
> getters and
> setters.
>  
> Any help on this would be greatly appreciated.
>  
> Thanks in advance.
>  
> Adrian Cunningham
>  
> 
> 
> --
> 
> This e-mail is confidential and is intended for the
> named recipient only. If
> you receive it in error please destroy the message
> and all copies. Kainos
> Software Ltd. does not accept liability for damage
> sustained as a result of
> malicious software (e.g. viruses). Kainos does not
> accept liability for, or
> permit; the creation of contracts on its behalf by
> e-mail, the publication of
> any defamatory statement by its employees by e-mail,
> or changes subsequently
> made to the original message. The Company's
> registered office is located at
> 4-6 Upper Crescent, Belfast, BT7 1NT, Northern
> Ireland, Tel +44 28 9057 1100.
> 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>