Re: Newbie needs help with sub-classes outside my main servlet
Richard Yee <[email protected]>
| Newsgroups | gmane.comp.java.sun.servlet |
|---|---|
| Message-ID | <[email protected]> |
Kenny, Put the class in a package and then import it. -Richard At 12:27 PM 3/6/2003 -0600, you wrote: >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 > > > > > > >___________________________________________________________________________ > > >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 > > > > > > > >___________________________________________________________________________ > > 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 > > > >___________________________________________________________________________ >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 ___________________________________________________________________________ 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