Anish,

Try specifying the type property of the logic tag.

>From the Jakarta Struts site...

"Fully qualified Java class name of the element to be exposed through the
JSP bean named from the id attribute. If not present, no type conversions
will be performed. NOTE: The actual elements of the collection must be
assignment-compatible with this class, or a request time ClassCastException
will occur."

So your logic tag would look like:
<logic:iterate collection="allTheCoins" id="coinName" type="your fullly
qualified class name">

Princeton

-----Original Message-----
From: Anish Acharya [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 19, 2001 8:27 AM
To: Struts Help (E-mail)
Subject: iterating over a collection


Hello everyone.  Just wondering if anyone can spot the error in this code:

<% Vector allTheCoins = (Vector)(application.getAttribute("allCoins"));
%>

<logic:iterate collection="allTheCoins" id="coinName">

        <TR>
                <TD>    <bean:write name="coinName"/> </TD>

        </TR>

</logic:iterate>

I have traced it to the logic tag -- the vector does initialize properly.
All of the elements
of the vector are strings.  Struts gives me an error claming it "can not
convert Java.lang.String
into Java.lang.object".

I've pulled out all my hair trying to figure this one out -- any help would
be appreciated.

Thanks in advance,

-Anish

Reply via email to