Why use the otherwise clause? I just  use an 'if' tag inline.

<select name="Select Name Here" size="1" >
<c:forEach var="varNameHere" items="${varsVector}" varStatus="current"> <option <c:if test="${your_test_here}"> selected </c:if> value="your_value_here" > Your Display Text Here </option>
</c:forEach>
</select>


I agree, a mod would make this cleaner, but I don't feel it really obfuscates the HTML too much.

- Nic.



Justin F. Knotzke wrote:

<quote who=Don Albertson date=[041005 09:32]/>


I need to do that kind of thing a lot.
Here's my boilerplate:

<select name="Select Name Here" size="1" >
<c:forEach var="varNameHere" items="${varsVector}" varStatus="current">
<c:choose>
<c:when test="${your_test_here}" >
<option selected value="your_value_here" > Your Display Text Here </option>
</c:when>
<c:otherwise>
<option value="your_value_here" > Your Display Text Here </option>
</c:otherwise>
</c:choose>
</c:forEach>
</select>




    So you do it "by hand". I was hoping that the input taglib would handle
this for me. The Struts taglib does. It knows to compare the values and if the
values equal, it marks it as 'selected'.

Anyhow, I wrote my own mod for the taglib that seems to work..

  Thanks for the reply. It's greatly appreciated.

  J







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to