struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From O_Parthasarathy Kesavaraj <Parthasarat...@PLANETASIA.COM>
Subject problem in logic:iterate using HashMap
Date Wed, 25 Jun 2003 10:36:54 GMT
Hi,
     I tried the same mentioned by Rick. But it gives me the following
error.

java.lang.NullPointerException
	at java.util.Hashtable.get(Hashtable.java:329)
	at
org.apache.jasper.runtime.PageContextImpl.findAttribute(PageContextImpl.java
:308) 

My code goes like this
<logic:iterate id="element"  property="userAdmins">
<TR>
	<TD><bean:write name="element" property="key"/> </TD> 
	<TD><bean:write name="element" property="value"/><BR></TD>
</TR>
</logic:iterate>

Here "useradmins" is HashMap in a formbean (I haven't specified
name="formbeanName" [because it is Not mandatory]). Surprisingly the error
is for Hashtable!!!

Please help me.

> ----------
> From: 	Rick Reumann[SMTP:r@reumann.net]
> Reply To: 	Struts Users Mailing List
> Sent: 	Tuesday, June 24, 2003 8:28 PM
> To: 	Struts Users Mailing List
> Subject: 	RE: logic:iterate using HashMap
> 
> On Tue, 2003-06-24 at 10:46, O_Parthasarathy Kesavaraj wrote:
>  
> > > O_Parthasarathy Kesavaraj írta:
> > 	Thanks Tib.I did look at the docs.But i got struck up.If u have any
> > sample code pls send.
> 
> I admit the docs I think are lame on this area. This should work..
> 
> <logic:iterate id="element" name="yourMap">
>     <bean:write name="element" property="key"/> - 
>     <bean:write name="element" property="value"/><BR>
> </logic:iterate>
> 
> JSTL should be something like...
> 
> <c:forEach var="element" items="${yourMap}">
>   <c:out value="${element.key}"/> -
>   <c:out value="${element.value}"/><br>
> </c:forEach>
> 
> -- 
> Rick
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 

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


Mime
View raw message