tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anand Bashyam Narasimham <>
Subject RE: Default classes loaded by Tocmat
Date Wed, 26 Dec 2001 20:31:26 GMT

I know Tomcat has always been a standards compliant implementation. But will
it be possible say for developers to have extensions where instead of
writing the import statements in a whole lot of JSPs we make sure the Class
loader loads this as a extension to the list you've mentioned using some
config file read at startup. 

I do agree that this make it a non-portable JSP, going against the spirit of
Java and J2EE but today everything written on J2EE though Java is almost 60%
not portable onto a different implementation :) 

Can this be done?


-----Original Message-----
From: Craig R. McClanahan []
Sent: Wednesday, December 26, 2001 12:26 PM
To: Tomcat Developers List
Subject: RE: Default classes loaded by Tocmat

On Wed, 26 Dec 2001, Anand Bashyam Narasimham wrote:

> Date: Wed, 26 Dec 2001 11:56:45 -0800
> From: Anand Bashyam Narasimham <>
> Reply-To: Tomcat Developers List <>
> To: 'Tomcat Developers List' <>
> Subject: RE: Default classes loaded by Tocmat
> Craig,
> I get the idea but as u said if the Web-app class loader delegates it to
> Parent Class loader and at some point it will go to the VM's primary class
> loader. If that is how it works then while I start tomcat my entire JDK's
> classes are in the Class path

More precisely, they are *visible* to your web application -- Tomcat
doesn't actually use the CLASSPATH environment variable for this.

> so if I have a JSP that uses java.util.Vector
> and not included in the "<@import" list the JSP should compile. However it
> does not. I'm using tomcat 3.3 If I remember right there was a significant
> change in how classes are loaded from 3.3 to 4.0.

This is a completely separate issue.

You have to explicitly import classes you use in JSP pages, just like you
do when you compile any Java class, unless the compiler already knows
about them.  For example, you don't have to say "import java.lang.String"
because the compiler already knows about it - but you *do* have to say
"import java.util.Vector" if you want one.  The same is true in JSP pages.

The default imports in a JSP page are defined in the JSP spec (JSP 1.3,
Section 2.10.2, page 50):


so anything else you want must be explicitly imported.  Tomcat 3.2
mistakenly included some other classes (this was a bug, because the above
list was correct for JSP 1.1 as well).  Tomcat 4 enforces the list defined
above.  I don't know anything about whether 3.3 fixed this bug or not.

> Thanks.
> Anand


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

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

View raw message