tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Funk <funk...@joedog.org>
Subject Re: Package names of compiled java class are all "org.apache.jsp"
Date Tue, 15 Apr 2003 11:17:05 GMT
There is no way to do this now. In tomcat5, the package will probably (was 
discussed) somewhat mirror the file path the jsp lives in.

 From my glancing at the spec, there is no restriction that a jsp must live 
in a specific package name (beyond those imposed by the java language).

Tomcat chooses the same package for every class because it can. Since each 
JSP is loaded by its own classloader, they could have gone as far as 
compiling every jsp into a package called cowbell and class name NeedMore. If 
your site had 100 jsps, you would still have 100 instances of 
cowbell.NeedMore but each instance would be under its own classloader and no 
one would be the wiser.

But tomcat 5 will probably ditch this scheme since debuggers will only start 
a trace on package.Class.[method]. If all your classes have the same package 
and classname, you get a lot of needless breakpoints in your debugger since 
debuggers typically ignore classloaders.

-Tim

Hua Hou wrote:
> I don't have a package statement at the top of my jsp. The reason is that
> there are thousands of jsp files and complex directory structures, I don't
> want to change those jsp files.
> 
> I just want /examples/A.jsp to be compiled into org.apache.jsp package, and
> /examples/jsp/A.jsp to be compiled into org.apache.jsp.jsp package.
> 
> With Jasper Shell (for pre-compilation of jsp), I was able to achieve this.
> However, through browser, this is not happening. So I think there must be
> some configuration that needs to be set up to do this. Any idea?
> 
> Thanks.
> 
> Hua
> 
> -----Original Message-----
> From: Shapira, Yoav [mailto:Yoav.Shapira@mpi.com]
> Sent: Monday, April 14, 2003 1:26 PM
> To: Tomcat Users List
> Subject: RE: Package names of compiled java class are all
> "org.apache.jsp"
> 
> 
> 
> Howdy,
> Do you have a package statement at the top of your jsp?  If not, Jasper
> will use its own default, which is org.apache.jsp.  It's good practice
> to have a package in your jsps (and other classes).
> 
> Yoav Shapira
> Millennium ChemInformatics
> 
> 
> 
>>-----Original Message-----
>>From: Hua Hou [mailto:hua@handango.com]
>>Sent: Monday, April 14, 2003 2:23 PM
>>To: 'Tomcat Users List'
>>Subject: Package names of compiled java class are all "org.apache.jsp"
>>
>>All,
>>
>>Can somebody shed some light on why all my compiled jsp files have same
>>java
>>package name "org.apache.jsp" even if I have the following directory
>>structure:
>>
>><Apache-home>
>>    +-- webapps
>>           +-- examples
>>                  +-- A.jsp
>>                  +-- jsp (dir)
>>                       +-- A.jsp
>>
>>When the above two A.jsp files (examples/A.jsp and examples/jsp/A.jsp)
> 
> are
> 
>>compiled into java files,
>>i.e.,
>>examples/A.jsp --> work/Standalone/localhost/examples/A_jsp.java
>>examples/jsp/A.jsp -->
> 
> work/Standalone/localhost/examples/jsp/A_jsp.java
> 
>>They both have the same package name "org.apache.jsp".
>>
>>How can I configure so that examples/A.jsp has the package name
>>"org.apache.jsp" and examples/jsp/A.jsp has the package name
>>"org.apache.jsp.jsp"?
>>
>>Thanks.
>>
>>Hua
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message