tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: Accessing a class file under WEB-INF/classes from JSP
Date Wed, 23 May 2007 18:57:01 GMT
You have to package the classes and then refer to them by their fully 
qualified name -- ie javax.servlet.http.HttpServletRequest.  This change 
was made a long time ago (tomcat 4.x?).

The classes themselves have to be in either a jar file in WEB-INF/lib or 
in a folder structure mirroring the package in WEB-INF/classes.  
HttpServletRequest.class of the package javax.servlet.http for example 
would be in WEB-INF/classes/javax/servlet/http

I know in some corner conditions packageless classes have been allowed 
(ie servlet class names), but it's really a much better practice to get 
them into declared packages.

--David

Rajiv M wrote:

> No. This will again give class cannot be resolved to type error
>
> On 5/23/07, Robert Soeding <robert.soeding@gmx.net> wrote:
>
>> Does
>> <%@page import="YourClass"%>
>> work?
>>
>> Rajiv M wrote:
>> > Seems like with JDK 1.4, Sun has enforced classes belonging to the
>> > default package from being imported in JSP. Is the only way to resolve
>> > the problem is to include classes under a package and then import the
>> > package in JSP?
>> >
>> > Or is there some way in Tomcat which can cause JSP to access the class
>> > files from WEB-INF/classes directory
>> >
>> > ---------------------------------------------------------------------
>> > To start a new topic, e-mail: users@tomcat.apache.org
>> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> > For additional commands, e-mail: users-help@tomcat.apache.org
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message