You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Hongsong Zhou <Ho...@UTSouthwestern.edu> on 2003/01/08 23:13:47 UTC

Tomcat 4.1.18 jsp import and include error

I installed Tomcat 4.1.18 under Windows 2000 Server and IIS, everything
is fine except two errors:
1. In jsp, when I import a class, this class should in some package,
otherwise you get ClassNotFoundException. But in Tomcat 4.0.4 I can
import a class without package. Is this a Tomcat 4.1.18 feature or bug
?

Example:
with package :
<%@ page import="testPackage.TestData" %>
is ok but without package :
<%@ page import="TestData" %>
you get exception.

2. In jsp, I can only include other jsp pages under that context, and I
can only use relative path, I can not use full url or cross context. I
still can do that in Tomcat 4.0.4, but in Tomcat 4.1.18 I can not.

Example:
if I have a context testContext, under that I have a folder jsp, and a
test.jsp under jsp folder.
use relative path is ok
<%@ include file="/jsp/test.jsp"%>
but can not use full url
<%@ include file="http://myhost:port/testContext/jsp/test.jsp"%>
and can not cross context
<%@ include file="../../otherContext/otherJsp/otherTest.jsp"%>



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


Re: Tomcat 4.1.18 jsp import and include error

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 9 Jan 2003, David Hemingway wrote:

> Date: Thu, 9 Jan 2003 18:18:09 +1100
> From: David Hemingway <db...@kooee.com.au>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: Tomcat Users List <to...@jakarta.apache.org>
> Subject: Re: Tomcat 4.1.18 jsp import and include error
>
> Noel,
>
> I think they have clamped down in tomcat 4.1.X all classes now muct be
> within packages. This wasn't the case in tomcat 4.0.X or before. When I
> changed from 4.0.6 to 4.1.12 I had to formally package all of my beans
>

It's *not* actually a Tomcat issue at all; it's a JDK issue.  JDK 1.4.1
enforces the Java Language Specification requirement (discussed below),
whereas JDK 1.3 did not.  There is no Tomcat involvement in *any* of this
(other than the fact that it uses the standard reflection capabilities
provided by the JVM).

Bottom line -- the only reason a Tomcat 4.0.6 to 4.1.12 upgrade should
have caused you any grief with unpackaged classes is if you also upgraded
your JDK up to 1.4.1 or later.

> regards,
> Dave
>

Craig


>
> ----- Original Message -----
> From: "Noel J. Bergman" <no...@devtech.com>
> To: "Tomcat Users List" <to...@jakarta.apache.org>
> Sent: Thursday, January 09, 2003 6:08 PM
> Subject: RE: Tomcat 4.1.18 jsp import and include error
>
>
> > > with package : <%@ page import="testPackage.TestData" %> is ok
> > > but without package : <%@ page import="TestData" %> you get exception.
> >
> > See http://forum.java.sun.com/thread.jsp?forum=31&thread=231550.
> >
> > You ought to be able to use TestData without an import, since it is in the
> > default package, but according to the above, you cannot import a class
> > without a package name because the generated java import statement would
> be
> > considered invalid.  Mind you that isn't clear from JLS 7.5.1:
> >
> http://java.sun.com/docs/books/jls/second_edition/html/packages.doc.html#266
> > 99.
> >
> > --- Noel
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


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


Re: Tomcat 4.1.18 jsp import and include error

Posted by David Hemingway <db...@kooee.com.au>.
Noel,

I think they have clamped down in tomcat 4.1.X all classes now muct be
within packages. This wasn't the case in tomcat 4.0.X or before. When I
changed from 4.0.6 to 4.1.12 I had to formally package all of my beans

regards,
Dave


----- Original Message -----
From: "Noel J. Bergman" <no...@devtech.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Thursday, January 09, 2003 6:08 PM
Subject: RE: Tomcat 4.1.18 jsp import and include error


> > with package : <%@ page import="testPackage.TestData" %> is ok
> > but without package : <%@ page import="TestData" %> you get exception.
>
> See http://forum.java.sun.com/thread.jsp?forum=31&thread=231550.
>
> You ought to be able to use TestData without an import, since it is in the
> default package, but according to the above, you cannot import a class
> without a package name because the generated java import statement would
be
> considered invalid.  Mind you that isn't clear from JLS 7.5.1:
>
http://java.sun.com/docs/books/jls/second_edition/html/packages.doc.html#266
> 99.
>
> --- Noel
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


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


RE: Tomcat 4.1.18 jsp import and include error

Posted by "Noel J. Bergman" <no...@devtech.com>.
> with package : <%@ page import="testPackage.TestData" %> is ok
> but without package : <%@ page import="TestData" %> you get exception.

See http://forum.java.sun.com/thread.jsp?forum=31&thread=231550.

You ought to be able to use TestData without an import, since it is in the
default package, but according to the above, you cannot import a class
without a package name because the generated java import statement would be
considered invalid.  Mind you that isn't clear from JLS 7.5.1:
http://java.sun.com/docs/books/jls/second_edition/html/packages.doc.html#266
99.

	--- Noel


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