struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Duffy <duff...@yahoo.com>
Subject Re: Ugly struts tag to JSTL transformation?
Date Thu, 17 Jul 2003 15:44:37 GMT

Here's how I've done a drop-down in JSTL:

<jsp:useBean id="lineNumbers" 
             type="java.util.List"   
             scope="session"/>

<select name="print-line-number" 
        size="1" 
        title="Select a line number to print">
<c:forEach items="${lineNumbers}" var="lineNumber">
<c:choose>
<c:when test="${lineNumber == printLineNumber}">
<option selected="selected">
<c:out value="${lineNumber}"/></option>
</c:when>
<c:otherwise>
<option><c:out value="${lineNumber}"/></option>
</c:otherwise>
</c:choose>
</c:forEach>
</select>

HTH - MOD
--- Yansheng Lin <yansheng.lin@isogis.com> wrote:
> Hi I have to populate a drop down list with the
> following code.  I am having
> trouble converting it to JSTL.   Note that I had to
> use a <bean:define> for the
> collection to get this working. Didn't know any
> better at that time, I guess:). 
> 
> <-------code-------->
> <bean:define id="codes" name="manageCostForm"
> property="codes" />
> 
> <html:select property="item">
>   <html:options collection="codes" property="code"
> labelProperty="codeAndDescription"/>
> </html:select>
> <-------/code-------->
> 
> Thanks!
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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


Mime
View raw message