And
<option <c:if...
is not XML.

At 14:47 05/10/2004 -0400, you wrote:
I have my boilerplate set up that way because sometimes there is more
that is different than just the "selected".  More importantly it makes
it absolutely clear to someone else what my intent is.  Having spent a
lot of time doing maintenance on other peoples' code, I find it more
efficient in the long run to keep expressions readable.  (I also use
parens in places where operator precedence rules make them unnecessary.)
dga

Nic Werner wrote:

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]


---------------------------------------------------------------------
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]



Reply via email to