Thanks Martin I was confused, about how the iterator and c:out worked. But obviously it writes a new line in template space through each iteration.
Tom Forrester [EMAIL PROTECTED] Tel: +44 (0)1749 678245 -----Original Message----- From: Martin van Dijken [mailto:[EMAIL PROTECTED] Sent: 12 March 2004 12:11 To: Tag Libraries Users List Subject: RE: How to populate a FORM List object in template text for N results Hey Thomas, What exactly is the problem with using forEach? It simply loops an iterator, map, array or collection and displays it's body content while it has results left. <c:forEach items="${clientResult}" var="row"> <option value="<c:out value="${row.value}"/>"><c:out value="${row.text}"/></option> </c:forEach> Replace row.value and row.text with the access method for the variable in the row you're trying to dump. Martin -----Oorspronkelijk bericht----- Van: Thomas Forrester [mailto:[EMAIL PROTECTED] Verzonden: vrijdag 12 maart 2004 12:45 Aan: [EMAIL PROTECTED] Onderwerp: How to populate a FORM List object in template text for N results How do I write out template HTML to populate a FORM LIST object, from a SQL query result set. For example: <sql:query var="clientResult" scope="page"> select CLIENT_NAME from CLIENT </sql:query> // Now given that I don't know how many rows I will get back, I can't write out N number of <option value=... Lines, and if I use a forEach loop they will just get overwritten. <form name="form1" method="post" action=""> <select name="select"> <option value="firstValue">firstLabel</option> <option value="secondLable" selected>secondLabel</option> <option value="thiredValue">thirdLabel</option> </select> </form> Now given that I don't know how many rows I will get back, I can't write out N number of <option value=... Lines, and if I use a forEach loop they will just get overwritten. What is the technique to use here, or is there a special tag that will do this? --------------------------------------------------------------------- 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]
