You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Robert McIntosh <ro...@bull-enterprises.com> on 2003/01/25 01:00:19 UTC

[jelly] 'set' tag behaviour

I'm getting more familar with the Jelly tags and I just came across a 
curious behavior. My script looks like this:
<j:forEach var="current" items="${strings}">
  <j:set var="${current}" value="${current.concat(':value')}" />
    <j:choose>
      <j:when test="${current.equals('s2:value')}">
         <j:set var="output" value="We found s2: ${current}" />
      </j:when>
   </j:choose>
 </j:forEach>

where ${strings} is an ArrayList of strings.
What I expect to happen is that the first j:set tag sets a variable 
called 'current' with the current string value concatinated with 
":value", so it would look like "s1:value", "s2:value", etc. Then I'm 
doing a test for for one of these values, "s2:value" and setting some 
other variable. However, the test is failing as the 'current' variable 
doesn't have the ':value' portion added. For example if I change the 
test to:

<j:when test="${current.startsWith('s2')}">

Then my 'ouput' variable becomes: 'We found s2: s2'
instead of 'We found s2: s2:value'

Is this correct?
- Robert McIntosh



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>