Better store your collection in your form bean, instead of using
application.getAttribute("allCoins") ...

Then you can get rid of the <% ... %> in your jsp.

Then, use something like:

<logic:iterate name="nameOfYourFormBean" property="allTheCoins"
 type="com.yourcompany.Coin" id="coins">
 <tr>
    <td>
        <bean:write name="coins" property="coinName"/>
    </td>
 </tr>
<logic:iterate>


Best regards,
Bernhard


> -----Ursprüngliche Nachricht-----
> Von: Anish Acharya [mailto:[EMAIL PROTECTED]]
> Gesendet: Mittwoch, 19. September 2001 16:27
> An: Struts Help (E-mail)
> Betreff: 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