Hello,

I must be missing something simple here, but here is the question.

I have a servlet which is generating a CachedRowSet for holding the data for
processing by a JSP.  The jsp is using the struts tags, specifically, the
"logic:iterator" tag which requires a Collection of one of the following
types:

    array, java.util.Collection, ArrayList, Vector, juaa.util.Enumeration,
iterator, HashMap, Hastable or TreeMap.

There is a tag on the CachedRowSet called "toCollection()" which according
to the documentation returns a "java.util.Collection".  When ever I try to
convert it to a collection with the above method, I receive the following
error:

java.lang.ClassCastException: java.util.TreeMap
at sun.jdbc.rowset.CachedRowSet.toCollection(CachedRowSet.java:1057)

The basic code fragment which throws the exception looks like this:

        Collection myCollection = null;
        CachedRowSet crs = null;
        // do necessary setup and obtain valid CachedRowSet;
        try{
                crs.execute(getCon());
                crs.first();
                myCollection = crs.toCollection();
        }
        .
        .
        .

So the question is how to I manage to convert the CachedRowSet to one of the
above collections.

Regards,

Todd G. Nist
Email:   [EMAIL PROTECTED]

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to