You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fergal dalton <co...@hotmail.com> on 2002/05/03 14:14:38 UTC

query

Hi,

Just a small problem, i'm having a problem using the useBean tags in my jsp
page, i am trying to pass an arraylist from the model but i get the
following error.

<jsp:useBean id="sidebarObjects" scope="request" class="java.util.Iterator"
/>

Internal Servlet Error:

javax.servlet.ServletException:  Cannot create bean of class
java.util.Iterator

Any ideas
thanks.


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: query

Posted by David Graff <ph...@mindspring.com>.
----- Original Message -----
From: "fergal dalton" <co...@hotmail.com>
To: <to...@jakarta.apache.org>
Sent: Friday, May 03, 2002 08:14
Subject: query


>
> Hi,
>
> Just a small problem, i'm having a problem using the useBean tags in my
jsp
> page, i am trying to pass an arraylist from the model but i get the
> following error.
>
> <jsp:useBean id="sidebarObjects" scope="request"
class="java.util.Iterator"
> />
>
> Internal Servlet Error:
>
> javax.servlet.ServletException:  Cannot create bean of class
> java.util.Iterator

Fergal, java.util.Iterator is an Interface which cannot be instantiated.

You have to instantiate one of the concrete implementations of the
Collections classes to get an instance of this from the object.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: query

Posted by "Michael E. Locasto" <lo...@tcnj.edu>.
> <jsp:useBean id="sidebarObjects" scope="request"
class="java.util.Iterator"
> />
>
> Internal Servlet Error:
>
> javax.servlet.ServletException:  Cannot create bean of class
> java.util.Iterator
>
> Any ideas

Check out tomcat-users, and read the Iterator Javadocs. It's an
Interface;
you can't instantiate an Interface. Because of this, Iterator doesn't
support
javabean-style creation (no constructor, no properties, etc). Use your
own
custom class that conforms to the bean standard and implements (or uses)
Iterator instead. I really can't give you details, I have no idea what
your design requires.

-michael


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>