Re: Newbie needs help with sub-classes outside my main servlet

Milt Epstein <[email protected]>
Newsgroups gmane.comp.java.sun.servlet
Message-ID <[email protected]>
On Fri, 7 Mar 2003, Becky Phaneuf wrote:

> Your class file needs to be in a package.  I don't recall which
> specification requires it, but recently (especially Tomcat) servlet
> containers are enforcing this.

As far as I understand, this is a JVM requirement, it's got nothing to
do with Tomcat/servlet containers.  And recent versions of certain
JVMs (Sun's 1.4.X?) have started enforcing it.


> >>> [email protected] 03/06/03 10:27AM >>>
> I hate to sound stupid but I'm having trouble with this.  I created
> a public class named InitPts in a file named InitPts.java and
> compiled it to InitPts.class.  All these files reside in
> WEB-INF/classes.  In my main servlet I want to call InitPts but I
> always get a compile error saying not found.  I've tried "import
> InitPts" but it complains about missing a period.  I've tried
> putting inside my servlet the line "InitPts();" but it says class
> not found.  Any ideas what I'm doing wrong...I know it's something
> simple that I'm missing/not understanding.  Thank you very much,
> Kenny
>
> ----- Original Message -----
> From: "Minos Chadgidakis" <[email protected]>
> To: <[email protected]>
> Sent: Thursday, March 06, 2003 9:50 AM
> Subject: Re: Newbie needs help with sub-classes outside my main
> servlet
>
>
> > You can put the new classes inside WEB-INF/classes.You won't even
> > have to import them this way.However doing this continuesly,you
> > will quickly have many classes without any organization,so it's
> > really not suggested.  You can put them in packages, and then put
> > the packages inside WEB-INF/lib, alternatively, you can even have
> > folders inside WEB-INF/classes like:

> > /project01/templates/UserBean.class
> > /project01/helper/helper1.class
> > /project01/helper/helper2.class
> > /project01/servlets/servlet1.class
> >
> > Then you will have to use import in your servlet,for example to
> > use helper2 you first write import project01.helper.helper2; or
> > import project01.helper.*;
> >
> > Anyway all the paths start from WEB-INF/classes or WEB-INF/lib.
> > Start the easiest way.Put them in WEB-INF/classes without new
> > folders...  When this works, try to make folders.Then use the lib
> > directory.
> >
> >
> > On Thu, 6 Mar 2003 08:52:09 -0600, Kenny G. Dubuisson, Jr.
> <[email protected]> wrote:
> >
> > >Hello all.  I've run into a problem where a servlet has reached
> > >the max size allowed (8K lines).  I need to break it up into some
> > >external classes. The question I have is where to put the
> > >external classes.  I know my current servlet goes in my app's
> > >"WEB-INF/classes" directory.  But if I make a class that my
> > >servlet calls, where would I put it?  Do I need to make the
> > >external classes part of a package?  If so, where do I make my
> > >package's directory structure?
> > >
> > >Any help would be very appreciated.  I've checked in my java
> > >books but don't see a clear answer to what I'm wanting to do.
> > >Thanks, Kenny
> > >
> >
>

Milt Epstein
Research Programmer
Integration and Software Engineering (ISE)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
[email protected]

___________________________________________________________________________
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.