karen wrote:
                <s:iterator value="{'a','b'}" var='v'>
                                <s:property value='v'/>
                </s:iterator>

You've got a number of bugs here.

The first (not technical, more for human understanding) is that there are too many ambiguities. If you want to write ognl, tell the compiler that.

Another is that a one-character sequence denoted with '' is a char, not a string. If you want it to be a string, denote it with "" (and in order to do so, quote the full attribute value with '' instead of "").

Another is that you're not fetching the value from the right namespace. Values "set" in the valuestack are not on the stack but in a related hashmap, and you tell OGNL to look up a value in that instead of against the stack with the # character.


Try this:
<s:iterator value='%{{"a","b"}}' var="v">
  <s:property value="%{#v}"/>
</s:iterator>

As another poster noted, the iterator tag pushes the current iteration value on top of the stack, so this should be equivalent:

<s:iterator value='%{{"a","b"}}'>
  <s:property />
</s:iterator>

(Note, I didn't actually try these bits of code, and when I just grepped through my current project's codebase I didn't see %{} wrapped around the only two places where I use the list construction syntax {,,}...
...so if it doesn't work, I'd start by questioning that. :-)

-Dale

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

Reply via email to