• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

where to store servlets class in tomcat 5.5 server

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
i am developing a web application (jsp+servlets)
i am using tomcat 5.5
where to place my servlet class files in tomcat5.5 server ie in which directory the servlet are need to be placed.
[ November 26, 2007: Message edited by: Bear Bibeault ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The class files should go under:
tomcat/webapps/{YOUR-WEB-APP}/WEB-INF/classes/{YOUR-PACKAGE}/{YOUR-CLASSES}.

If you bundle your classes into a jar file, the file should go under:
tomcat/webapps/{YOUR-WEB-APP}/WEB-INF/lib/{YOUR-JAR-FILES}.
[ November 26, 2007: Message edited by: Ben Souther ]
 
K Sathya Narayanan
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The servlets having the default package should be saved in the

D:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ROOT\WEB-INF\classes --


but i dont know where to store
the servlet classes having package names;
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Servlets should not be in the default package.

The default package is for trivial command line apps and shouldn't be used web applications. You may get a servlet to work using it but as soon as you start to structure a more serious web app correctly, you're going to have problems locating beans and other objects from within your JSP pages.

See:
http://faq.javaranch.com/java/BeansNotFound
and
http://faq.javaranch.com/java/PackageYourBeans

for more details about this.
 
Ranch Hand
Posts: 119
Spring MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by K Sathya Narayanan:

but i dont know where to store
the servlet classes having package names;



As Ben told you before, the servlet should be placed under your application WEB-INF/classes if they were class files or under WEB-INF/lib if you package your serlvet in a jar file.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For example a class named SimpleServlet in the package com.javaranch.servlet in a webapp named SimpleServlet would go in:
tomcat/webapps/SimpleServlet/WEB-INF/classes/com/javaranch/servlet/SimpleServlet.class
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic