You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sudip Kumar Bhattacharya <su...@consulting.stgintl.com> on 2004/02/04 12:15:28 UTC

newbie - How to generate form controls dynamically in struts

Hi friends,

I need to create some controls dynamically which should be struts enabled.
Sample output code is as follows.
How can I use some collection/array to store the information, and then
render the html:fields, so that they are handled by struts like normal
hardcoded controls? I have seen some logic:iterator samples using
bean:message tags in them, but I could not find any sample that demonstrates
outputting struts html controls using an iterator.

-----------------------
<TR>
  <TD>English taken for 9th grade credit</TD>
  <TD><html:radio value=1 property=eng9/></TD>
  <TD><html:radio value=2 property=eng9/></TD>
  <TD><html:radio value=1 property=eng9_grade/></TD>
  <TD><html:radio value=2 property=eng9_grade/></TD>
  <TD><html:radio value=3 property=eng9_grade/></TD>
  <TD><html:radio value=4 property=eng9_grade/></TD>
  <TD><html:radio value=5 property=eng9_grade/></TD>
  <TD><html:radio value=1 property=eng9a/></TD>
  <TD><html:radio value=2 property=eng9a/></TD>
  <TD><html:checkbox value=3 property=eng9h/></TD>
</TR>
<TR>
  <TD>English taken for 10th grade credit</TD>
  <TD><html:radio value=1 property=eng10/></TD>
  <TD><html:radio value=2 property=eng10/></TD>
  <TD><html:radio value=1 property=eng10_grade/></TD>
  <TD><html:radio value=2 property=eng10_grade/></TD>
  <TD><html:radio value=3 property=eng10_grade/></TD>
  <TD><html:radio value=4 property=eng10_grade/></TD>
  <TD><html:radio value=5 property=eng10_grade/></TD>
  <TD><html:radio value=1 property=eng10a/></TD>
  <TD><html:radio value=2 property=eng10a/></TD>
  <TD><html:checkbox value=3 property=eng10h/></TD>
</TR>
-------------------------


Thanks in advance
Sudip



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: REPOST: newbie - How to generate form controls dynamically in struts

Posted by Andrew Hill <an...@gridnode.com>.
Have you looked at the tutorials on the Keyboard Monkey site?
It may prove helpful. (Concerns nested form beans. You may be able to make
use of these techniques to implement it?)
http://www.keyboardmonkey.com/next/index.jsp

Although in this case based on your sample output you could probably manage
using simple iteration and a collection in the form field. Worth taking a
look at the nested tutorials though.

-----Original Message-----
From: Sudip Kumar Bhattacharya [mailto:sudip@consulting.stgintl.com]
Sent: Thursday, 5 February 2004 19:50
To: Struts Users Mailing List
Subject: REPOST: newbie - How to generate form controls dynamically in
struts


Reposting my query since nobody answered it...

-----Original Message-----
From: Sudip Kumar Bhattacharya [mailto:sudip@consulting.stgintl.com]
Sent: Wednesday, February 04, 2004 4:45 PM
To: Struts Users Mailing List
Subject: newbie - How to generate form controls dynamically in struts


Hi friends,

I need to create some controls dynamically which should be struts enabled.
Sample output code is as follows.
How can I use some collection/array to store the information, and then
render the html:fields, so that they are handled by struts like normal
hardcoded controls? I have seen some logic:iterator samples using
bean:message tags in them, but I could not find any sample that demonstrates
outputting struts html controls using an iterator.

-----------------------
<TR>
  <TD>English taken for 9th grade credit</TD>
  <TD><html:radio value=1 property=eng9/></TD>
  <TD><html:radio value=2 property=eng9/></TD>
  <TD><html:radio value=1 property=eng9_grade/></TD>
  <TD><html:radio value=2 property=eng9_grade/></TD>
  <TD><html:radio value=3 property=eng9_grade/></TD>
  <TD><html:radio value=4 property=eng9_grade/></TD>
  <TD><html:radio value=5 property=eng9_grade/></TD>
  <TD><html:radio value=1 property=eng9a/></TD>
  <TD><html:radio value=2 property=eng9a/></TD>
  <TD><html:checkbox value=3 property=eng9h/></TD>
</TR>
<TR>
  <TD>English taken for 10th grade credit</TD>
  <TD><html:radio value=1 property=eng10/></TD>
  <TD><html:radio value=2 property=eng10/></TD>
  <TD><html:radio value=1 property=eng10_grade/></TD>
  <TD><html:radio value=2 property=eng10_grade/></TD>
  <TD><html:radio value=3 property=eng10_grade/></TD>
  <TD><html:radio value=4 property=eng10_grade/></TD>
  <TD><html:radio value=5 property=eng10_grade/></TD>
  <TD><html:radio value=1 property=eng10a/></TD>
  <TD><html:radio value=2 property=eng10a/></TD>
  <TD><html:checkbox value=3 property=eng10h/></TD>
</TR>
-------------------------


Thanks in advance
Sudip



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


REPOST: newbie - How to generate form controls dynamically in struts

Posted by Sudip Kumar Bhattacharya <su...@consulting.stgintl.com>.
Reposting my query since nobody answered it...

-----Original Message-----
From: Sudip Kumar Bhattacharya [mailto:sudip@consulting.stgintl.com]
Sent: Wednesday, February 04, 2004 4:45 PM
To: Struts Users Mailing List
Subject: newbie - How to generate form controls dynamically in struts


Hi friends,

I need to create some controls dynamically which should be struts enabled.
Sample output code is as follows.
How can I use some collection/array to store the information, and then
render the html:fields, so that they are handled by struts like normal
hardcoded controls? I have seen some logic:iterator samples using
bean:message tags in them, but I could not find any sample that demonstrates
outputting struts html controls using an iterator.

-----------------------
<TR>
  <TD>English taken for 9th grade credit</TD>
  <TD><html:radio value=1 property=eng9/></TD>
  <TD><html:radio value=2 property=eng9/></TD>
  <TD><html:radio value=1 property=eng9_grade/></TD>
  <TD><html:radio value=2 property=eng9_grade/></TD>
  <TD><html:radio value=3 property=eng9_grade/></TD>
  <TD><html:radio value=4 property=eng9_grade/></TD>
  <TD><html:radio value=5 property=eng9_grade/></TD>
  <TD><html:radio value=1 property=eng9a/></TD>
  <TD><html:radio value=2 property=eng9a/></TD>
  <TD><html:checkbox value=3 property=eng9h/></TD>
</TR>
<TR>
  <TD>English taken for 10th grade credit</TD>
  <TD><html:radio value=1 property=eng10/></TD>
  <TD><html:radio value=2 property=eng10/></TD>
  <TD><html:radio value=1 property=eng10_grade/></TD>
  <TD><html:radio value=2 property=eng10_grade/></TD>
  <TD><html:radio value=3 property=eng10_grade/></TD>
  <TD><html:radio value=4 property=eng10_grade/></TD>
  <TD><html:radio value=5 property=eng10_grade/></TD>
  <TD><html:radio value=1 property=eng10a/></TD>
  <TD><html:radio value=2 property=eng10a/></TD>
  <TD><html:checkbox value=3 property=eng10h/></TD>
</TR>
-------------------------


Thanks in advance
Sudip



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org