Thanks for the tip, Dustin, but it's not working.

Though, I omitted the "information" part because that was only meant
to temporarily save a reference to the object that the Map returns -
an object of type InfoObject which has get- and set methods for the
property state. So I tried:

<s:if test="#session.myMap[#thisValue].state == 0">

but that still returns false though I know it should return true.

I'm wondering if it's a matter of type conversion. The get method of
HashMap returns an Object and I have not told Struts in any way that
this value should be converted to my InfoObject. Perhaps I should do
that, in an xml file or something? (I'm a real newbie at Struts 2 as
you can tell.)

/Ylva


On Tue, Aug 19, 2008 at 5:20 PM, Dustin Pearce <[EMAIL PROTECTED]> wrote:
>
> Everything is fine except try:
>
> <s:if test="#session.myMap[#thisValue].information.state == 0">
>
> you don't need the %{#thisValue}, its already being evaluated.  You also
> don't need the set, just navigate the object graph in your test.
>
>
>
> On Aug 19, 2008, at 5:43 AM, Ylva Degerfeldt wrote:
>
>> Hi,
>>
>> First of all: This problem is about jsp tags. Secondly: This is a
>> problem which has several steps and I don't know which step I've done
>> wrong so I'll just show you what I've tried to do:
>>
>> <s:iterator value = "#session.mySet" id = "thisValue">
>>
>>     <s:set name = "information" value = "#session.myMap[%{#thisValue}]"/>
>>
>>     <s:if test = "#information.state == 0">
>>           <s:property value = "#thisValue"/>
>>     </s:if>
>> .....
>>
>> Explanation: I iterate through a Set of Strings and call each value
>> "thisValue".
>> Then I want to use "thisValue" as a key to the HashMap "myMap" for
>> finding an object of my "InfoObject" class. The "InfoObject" class has
>> a property called "state".
>> I want to check for the received "InfoObject" if the "state" property
>> == 0. If it is I want to print the value of "thisValue".
>>
>> I know that the iterator tag works but it's the parts after that I'm
>> insecure about. About the s:set tag, I'm not sure if that's the way to
>> do it but I don't know how to check if it's correct when debugging.
>> The only thing I know is that the s:if tag is supposed to return true
>> and it doesn't.
>>
>> I would guess it's either a matter of the syntax I used for the
>> "value" of the s:set tag or that Struts can't resolve that the type of
>> the "information" object is "InfoObject", or both.
>> How should I do this?
>>
>> Thanks in advance!
>>
>> /Ylva
>>
>> ---------------------------------------------------------------------
>> 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