You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by shanmugampl <sh...@india.adventnet.com> on 2003/07/05 10:20:33 UTC

Getting an error while using forEach Tag

Dear All,

       I am using forEach tag for iterating over an ArrayList present in 
the session scope. The code I have used is

<core:forEach var="image" items="${TREE-IMAGES}">
    ------
    ------
</core:forEach>

       When i execute this page I get the following error

An error occurred while evaluating custom action attribute "items" with value "${TREE-IMAGES}": Attempt to coerce a value of type "java.util.ArrayList" to type "java.lang.Long" (null


   But if I get the value and store it in a different name the forEach tag works properly. The changed code is

<%
java.util.ArrayList list = (java.util.ArrayList)pageContext.findAttribute("TREE-IMAGES");
session.setAttribute("IMAGES",list); 
%>
<core:forEach var="image" items="IMAGES">
	-----
	-----
</core:forEach>


   This works properly. Will there be a problem if there is a - in the variabe name or have i misunderstood something.

Thanks
Shanmugam PL 




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


Re: Getting an error while using forEach Tag

Posted by Yann C�bron <ya...@yahoo.de>.
> Dear All,
>
>        I am using forEach tag for iterating over an ArrayList present in
> the session scope. The code I have used is

</snip>

Please ask your question on the taglibs-user mailing list.





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