tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Chapman" <Andrew.Chap...@ons.gsi.gov.uk>
Subject Literal expressions in <c:set> tag
Date Mon, 22 Sep 2003 10:09:02 GMT
I have some html that I set in a variable for use in a loop. As it's
outputting a form element I'd like to increment it's name so I can
differentiate them. e.g.

<c:set var="formRow">
      <input type="text" name="address${rowIndex}"/>
</c:set>

<c:forEach begin="1" end="3" varStatus="status">
      <c:set var="rowIndex" value="${status.index}"/>
      <c:out ${formRow} escapeXml="false"/>
</c:forEach>

As the formRow variable is evaluated in the first c:set tag where rowIndex
isn't set I just get three input fields all named address. Is there a way
to defer evaluation of the $rowIndex expression until it is output in the
loop, e.g. by making c:set treat ${rowIndex} as a literal?

Thanks in anticipation...

Andy




For the latest data on the economy and society 
consult National Statistics at http://www.statistics.gov.uk

**********************************************************************
Please Note:  Incoming and outgoing email messages
are routinely monitored for compliance with our policy
on the use of electronic communications
**********************************************************************
Legal Disclaimer  :  Any views expressed by
the sender of this message are not necessarily
those of the Office for National Statistics
**********************************************************************

Mime
View raw message