You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pankaj Gupta <pa...@hsc.com> on 2006/06/24 10:34:19 UTC
How o display a hashtable in jsp
Hi,
Can you please suggest how can I display key and value(both) from a
hashtable in my jsp. Currently I am using the following approach but it
prints only the value and not the key.
<logic:iterate id="match" name="eventInfo">
<tr>
<td width="131"><font face="Arial" size="2"><bean:write
name="match" property="value"/></font> </td>
</tr>
</logic:iterate>
regards,
Pankaj
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How o display a hashtable in jsp
Posted by Martin Gainty <mg...@hotmail.com>.
you can use c:forEach items="MappedVariable"
take a look at
http://www-128.ibm.com/developerworks/java/library/j-jstl0318/
Viel Gluck,
Martin--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed. If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy. Thank you.
----- Original Message -----
From: "Martin Kindler" <ki...@arcor.de>
To: "'Struts Users Mailing List'" <us...@struts.apache.org>;
<te...@patni.com>
Sent: Monday, June 26, 2006 5:38 AM
Subject: AW: How o display a hashtable in jsp
Hi Pankaj,
if you use JSTL you can have a java.util.Map as the collection type you are
iterating over. The only trick is that the item you operate on in each
iteration is a java.util.Map.Entry, i.e. you must access its key/value
accordingly.
The same is true, if you are using Struts logic tags.
Martin
> -----Ursprüngliche Nachricht-----
> Von: Tejas Bavishi [mailto:tejas.bavishi@patni.com]
> Gesendet: Montag, 26. Juni 2006 11:06
> An: 'Struts Users Mailing List'
> Betreff: RE: How o display a hashtable in jsp
>
>
> Hi Pankaj
>
> Not sure if this can be done by the tag, may be others can
> comment. But you can definitely do this using a scriptlet.
> Hashtable has keys() method that returns an Enumeration of
> keys. You can traverse through this enumeration to print the
> keys and corresponding values.
>
> Hope that helps
>
> Regards
> Tejas
>
>
> -----Original Message-----
> From: Pankaj Gupta [mailto:pankaj.gupta@hsc.com]
> Sent: Saturday, June 24, 2006 2:04 PM
> To: Struts Users Mailing List
> Subject: How o display a hashtable in jsp
>
>
> Hi,
>
> Can you please suggest how can I display key and value(both)
> from a hashtable in my jsp. Currently I am using the
> following approach but it prints only the value and not the key.
>
> <logic:iterate id="match" name="eventInfo">
> <tr>
> <td width="131"><font face="Arial"
> size="2"><bean:write name="match" property="value"/></font> </td>
> </tr>
> </logic:iterate>
>
> regards,
> Pankaj
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> http://www.patni.com
> World-Wide Partnerships. World-Class Solutions.
> _____________________________________________________________________
>
> This e-mail message may contain proprietary, confidential or
> legally privileged information for the sole use of the person
> or entity to whom this message was originally addressed. Any
> review, e-transmission dissemination or other use of or
> taking of any action in reliance upon this information by
> persons or entities other than the intended recipient is
> prohibited. If you have received this e-mail in error kindly
> delete this e-mail from your records. If it appears that
> this mail has been forwarded to you without proper authority,
> please notify us immediately at netadmin@patni.com and delete
> this mail.
> _____________________________________________________________________
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
AW: How o display a hashtable in jsp
Posted by Martin Kindler <ki...@arcor.de>.
Hi Pankaj,
if you use JSTL you can have a java.util.Map as the collection type you are
iterating over. The only trick is that the item you operate on in each
iteration is a java.util.Map.Entry, i.e. you must access its key/value
accordingly.
The same is true, if you are using Struts logic tags.
Martin
> -----Ursprüngliche Nachricht-----
> Von: Tejas Bavishi [mailto:tejas.bavishi@patni.com]
> Gesendet: Montag, 26. Juni 2006 11:06
> An: 'Struts Users Mailing List'
> Betreff: RE: How o display a hashtable in jsp
>
>
> Hi Pankaj
>
> Not sure if this can be done by the tag, may be others can
> comment. But you can definitely do this using a scriptlet.
> Hashtable has keys() method that returns an Enumeration of
> keys. You can traverse through this enumeration to print the
> keys and corresponding values.
>
> Hope that helps
>
> Regards
> Tejas
>
>
> -----Original Message-----
> From: Pankaj Gupta [mailto:pankaj.gupta@hsc.com]
> Sent: Saturday, June 24, 2006 2:04 PM
> To: Struts Users Mailing List
> Subject: How o display a hashtable in jsp
>
>
> Hi,
>
> Can you please suggest how can I display key and value(both)
> from a hashtable in my jsp. Currently I am using the
> following approach but it prints only the value and not the key.
>
> <logic:iterate id="match" name="eventInfo">
> <tr>
> <td width="131"><font face="Arial"
> size="2"><bean:write name="match" property="value"/></font> </td>
> </tr>
> </logic:iterate>
>
> regards,
> Pankaj
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> http://www.patni.com
> World-Wide Partnerships. World-Class Solutions.
> _____________________________________________________________________
>
> This e-mail message may contain proprietary, confidential or
> legally privileged information for the sole use of the person
> or entity to whom this message was originally addressed. Any
> review, e-transmission dissemination or other use of or
> taking of any action in reliance upon this information by
> persons or entities other than the intended recipient is
> prohibited. If you have received this e-mail in error kindly
> delete this e-mail from your records. If it appears that
> this mail has been forwarded to you without proper authority,
> please notify us immediately at netadmin@patni.com and delete
> this mail.
> _____________________________________________________________________
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: How o display a hashtable in jsp
Posted by Tejas Bavishi <te...@patni.com>.
Hi Pankaj
Not sure if this can be done by the tag, may be others can comment. But you
can definitely do this using a scriptlet.
Hashtable has keys() method that returns an Enumeration of keys. You can
traverse through this enumeration to print the keys and corresponding
values.
Hope that helps
Regards
Tejas
-----Original Message-----
From: Pankaj Gupta [mailto:pankaj.gupta@hsc.com]
Sent: Saturday, June 24, 2006 2:04 PM
To: Struts Users Mailing List
Subject: How o display a hashtable in jsp
Hi,
Can you please suggest how can I display key and value(both) from a
hashtable in my jsp. Currently I am using the following approach but it
prints only the value and not the key.
<logic:iterate id="match" name="eventInfo">
<tr>
<td width="131"><font face="Arial" size="2"><bean:write
name="match" property="value"/></font> </td>
</tr>
</logic:iterate>
regards,
Pankaj
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
http://www.patni.com
World-Wide Partnerships. World-Class Solutions.
_____________________________________________________________________
This e-mail message may contain proprietary, confidential or legally
privileged information for the sole use of the person or entity to
whom this message was originally addressed. Any review, e-transmission
dissemination or other use of or taking of any action in reliance upon
this information by persons or entities other than the intended
recipient is prohibited. If you have received this e-mail in error
kindly delete this e-mail from your records. If it appears that this
mail has been forwarded to you without proper authority, please notify
us immediately at netadmin@patni.com and delete this mail.
_____________________________________________________________________