<% // Assume you got a reference to your action form in af, // and that is has a getUpperLimit() method... int ul = af.getUpperLimit(); for (int i = 0; i < ul; i++) { %> <input type="checkbox" name="value<%=i%>"> <% } %>
Not much more than that required. To make them retain state, you'll have to provide some method to determine when a given checkbox is checled, and add a checked attribte accordingly, something like:
<input type="checkbox" name="value<%=i%>" <%=af.getIsChecked(i)=true?"checked":"">
That'll do the trick, assuming getIsChecked() accepts an index value and returns a boolean stating whether that particular checkbox is checked or not.
I have a personal distaste for taglibs in most cases, I know many people disagree, but I figured you might as well know all your options, then you can choose whickever you prefer from an informed position.
-- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com
Jim Barrows wrote:
-----Original Message----- From: Kedar Deshpande [mailto:[EMAIL PROTECTED] Sent: Friday, December 17, 2004 1:52 PM To: Struts Users Mailing List Subject: Re: creating a for loop structure for multibox
i am currently using struts tags and cant find a proper solution. it would be better to have a simple struts code, otherwise i'll try to use the JSTL.
Then you want the logic:iterate tag.
thank you Kedar
Jim Barrows wrote:
-----Original Message----- From: Kedar Deshpande [mailto:[EMAIL PROTECTED] Sent: Friday, December 17, 2004 1:21 PM To: [EMAIL PROTECTED] Subject: creating a for loop structure for multibox
Could someone please post an example of using a 'for loop' structure in
Using JSTL, or Struts tag libs?
a JSP. i need to get the loop limit from the action and then assign individual 'value' values for a column of checkboxes so that i know which ones were selected and so that they can be set again when viewing the page.
thanks
------------------------------------------------------------
---------
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]
--------------------------------------------------------------------- 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]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]