Hi Anthony,

I believe you may need to declare the getters that return the ArrayList to
return a Collection. I don't think that an ArrayList would work.
Alternatively, you may make the getters return an array, and convert the
ArrayList to an array when it gets returned. However, I believe the first
solution should suffice.

hope this helps,
Iraklis

-----Original Message-----
From: Anthony Martin [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 08, 2001 1:50 PM
To: '[EMAIL PROTECTED]'
Subject: ArrayList of beans


Any idea why the following...

        --Snip: ActionForm BEGIN--

        // List of values
        private List specialdatetypeList = new ArrayList() ;

        // Specified by: interface Specialdate
        public List getSpecialdatetypeList ( ) { return
this.specialdatetypeList ; }

        // Specified by: interface Specialdate
        public void setSpecialdatetypeList ( List specialdatetypeList ) {
this.specialdatetypeList = specialdatetypeList ; }

        --Snip: ActionForm END--
        --Snip: JSP BEGIN--

        <bean:define id="specialdatetypeList" name="specialdateForm"
property="specialdatetypeList"
type="com.trams.struts.cbplus.SpecialdatetypeForm" />
        <html:select property="specialdatetypeLinkno">
                <html:options collection="specialdatetypeList"
property="specialdateno" labelProperty="specialdatetype" />
        </html:select>

        --Snip: JSP END--

...produce the following error?

        --Snip: Error BEGIN--

        Internal Servlet Error:

        javax.servlet.ServletException: java.util.ArrayList
                at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:459)
        .
        .
        .

        Root cause:
        java.lang.ClassCastException: java.util.ArrayList
                at
_0002feditSpecialdate_0002ejspeditSpecialdate_jsp_18._jspService(_0002feditS
pecialdate_
        .
        .
        .
        --Snip: Error END--

I don't show it here, but I assign beans with getters and setters for
specialdateno and specialdatetype to each index of the ArrayList.


Anthony

It is by caffeine alone I set my mind in motion.
It is by the Beans of Java that thoughts acquire speed,
the hands acquire shaking, the shaking becomes a warning.
It is by caffeine alone I set my mind in motion.

Reply via email to