tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Morrow, Steve D." <SMor...@fhlbdm.com>
Subject RE: Loop Tags
Date Thu, 15 Jan 2004 16:54:58 GMT
The standard tag library offers that functionality. Make sure the c.tld is
in your web-inf directory...

<!-- as an example, with locations as a jav.util.Collection of Location
objects with getters... -->
<select name="location">
    <option value="">Select a Station ID</option>
    <c:forEach var="location" items="${locations}">
        <option value="<c:out value="${location.id}"/>"><c:out
value="${location.name}"/></option>
    </c:forEach>
</select>

> -----Original Message-----
> From: Anthony Smith [mailto:anthony.smith@fedex.com] 
> Sent: Thursday, January 15, 2004 10:46 AM
> To: taglibs-user@jakarta.apache.org
> Subject: Loop Tags
> 
> 
> I am fairly new to taglibs...
> 
> However as I start to create more jsps. I have decided to 
> take advantage for
> 
> tags for better MVC compilancy and code re-use. I looked through the
> 
> standard tags, but did not see what I was looking for.
> 
> I am looking for tags that I can use for things like for 
> loops and such.
> 
> Instead of doing things like:
> 
> <select name="stationId">
> 
> <option value="">Select a Station ID</option>
> 
> <%
> 
> for( int i = 0; i < locations.length; i++ )
> 
> {
> 
> %>
> 
> <option
> 
> value="<%=locations[i].value()%>"><%=locations[i].value()%></option>
> 
> <%
> 
> }
> 
> %>
> 
> </select>
> 
> 
> 
> Cleaning that code up even more where my for loop is in a 
> tag. Where can I
> 
> find such a tag?
> 


This message and any files transmitted with it are confidential and are
intended solely for the use of the individual or entity to whom they are
addressed.  If you have received this email in error, please delete the
email and any files transmitted with it entirely from your computer. 



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


Mime
View raw message