I am not exactly sure what you are asking. Consider posting a minimal but
complete code (JSP, Java) example to help us understand if the following
info doesn't help:

Hashtable.elements() returns an Enumeration of the values, not the keys. I
believe that logic:iterate will just iterate though the Enumeration of
values.

hash.contains(new String("one")) will return false in your example code,
because there is no map entry with a value of "one". I think you mean
hash.containsKey("one"), which is much faster and will return true. Read the
API docs:
http://java.sun.com/j2se/1.4.1/docs/api/java/util/Hashtable.html

Also, the newer HashMap class might be faster than Hashtable, since HashMap
is not synchronized.

-Max

----- Original Message -----
From: "shashi_struts" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, March 05, 2003 10:04 PM
Subject: how to get a single value from hashtable


hi
i am using the struts and jstl in my web application and using the
logic:iterate for iterating the hashtable,arraylist.
I faced the problem at this point:-
i am getting any tag for retrival of only one value from the hashtable that
we are getting through java function.
ex:-
Hashtable hash=new Hashtable();
hash.put("one","first");
hash.put("two","second");
the code i am using in java is
if(hash.contains(new String("one"))
String value=hash.get(new String("one"))

but i am not getting this using struts or jstl

Please help me
Regards





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

Reply via email to