Subject: Getting an object from a Hashtable
From: "Scott Curtis" <[EMAIL PROTECTED]>
 ===
Hi,

I want to be able to check the value of a property held within a hashtable
using a Struts tag such as <logic:equal />. For example I have a Hashtable
which contains a collection of JavaBeans. In the JSP I know the key for each
object in the Hashtable. I want to be able to select an object from the
Hashtable according to a specified key and then compare a property value in
the returned object using it's getter.

Something along these lines:

MyBean contains a Hashtable called myHash full of JavaBean conformant
objects. MyBean has a getter to return the Hashtable getMyHash(). Each of
the objects in the Hashtable is of type AnotherBean and they all have
getters and setters. I want to get an object from the Hashtable using the
key "obj1". The bean returned using "obj1" has a 'valid' property with a
getter isValid().

This is what I want to do but it doesn't work obviously because Hashtable
isn't a bean that can be queried from property getters and setters:

<logic:equal name="MyBean" property="myHash.obj1.valid" value="false">
    Do something here.
</logic:equal>

Is there another tag I can use to first get the AnotherBean from myHash in
order for it to be used in the tag above? So basically me question is really
simply how can I get an object from a Hashtable using Struts tags or any
other tags out there? I don't want to iterate the Hashtable by the way.

Thanks, if anyone understands that and can help. :-)
 - scott



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to