tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Wilson <>
Subject Tomcat 5.0.16 jsp:useBean of type java.util.List won't compile
Date Mon, 12 Jan 2004 19:50:25 GMT
I have some jsp pages that now break in Tomcat 5.0.16.
 In particular, my use of the jsp:useBean tag is no
longer working, it fails to compile.

## <jsp:useBean id="myListBean" scope="session"

In the generated servlet, it attempts to do a

## java.util.List myListBean = new java.util.List();

which does not work, since it is not a concrete class.

In the version of Tomcat I was working with (4.1.*),
it didn't use a hard coded constructor, for example: 

## myListBean = (java.util.List)

Using reflection to call the constructordid not create
a compile time error.  This was good, in any case,
because my JSP is never supposed to instantiate these
beans, they are created by a servlet that forwards the
request to them.

Does anyone know why this new JSP servlet generator
uses this type of constructor?  It seems like it would
break A LOT of code out there, where a JPS page uses
the useBean to get a bean that is supposed to already
be existing in the specified scope.  Or are we
supposed to only put concrete objects in our class
types, and only those that have a no-arg constructor?

Is there something new in the jsp 2.0 spec that allows
me to define a bean that will never be instantiated in
the page itself?

My workaround is to remove all the jsp:useBean tags
and just use scriptlets to get at the objects.

## <% java.util.List myList = (java.util.List)
session.getAttribute("myList"); %>

Once again, is there anyway that I can use jsp:useBean
with classes like java.util.List or even classes that
I have written that do not provide a no-arg

Thanks for any assistance,

Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message