Probably because everything stored in a Vector is an object of type Object
and <bean:write> is trying to cast your Element object to a String.

Mark

-----Original Message-----
From: Slimane [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 06, 2002 5:08 PM

Hi,

I try to do an iteration on a vector. When this vector contains only 
Strings, the iteration works well. For that, I use the following piece of
code:

><logic:iterate id="elt" name="listform" scope="session" property="vect">
>   <bean:write name="elt" /><BR>
></logic:iterate>

But, when I try with a vector containing custom objects, it doesn't work :(
For example, I have a Vecor of Element. Element is a bean which contains 2 
attributes (2 String named: id and name)
To iterate on that vector, I use the following piece of code:

><logic:iterate id="elt" name="listform" scope="session" property="vect" 
>type="be.stluc.info.struts.Element">
>   <bean:write name="elt" property="name"/><BR>
></logic:iterate>

That doesn't work, and the following exception is thrown:

>Apache Tomcat/4.0.1 - HTTP Status 500 - Internal Server Errortype 
>Exception reportmessage Internal Server Errordescription The server 
>encountered an internal error (Internal Server Error) that prevented it 
>from fulfilling this request.exception java.lang.ClassCastException: 
>java.lang.String

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to