#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    10
    Rep Power
    0

    Basic steps to get a servlet online


    I have tried all day to understand this. I only want to understand how to get a simple servlet with the default Tomcat config working through Apache. I have everything installed, and the sample servlets in the webapps directory work fine. Here are my specs:

    OS: Debian Sid
    apache version: 1.3.23
    tomcat version: 3.3

    I have both tomcat and apache installed in /usr/local. I have my simple .class file in /usr/local/tomcat/webapps/. The tutorial at [url]http://developer.java.sun.com/developer/onlineTraining/Programming/BasicJava1/servlet.html leaves alot to be desired. Maybe I am just sick of looking for the answer, but I would appreciate some tips.

    With the location of my simple servlet, where would I put an html form to reference this servlet, and what path should I specify in the "ACTION= " section of the form? Once I understand how this mess works, I can start learning how to write servlets. Thanks for any help.

    Bob
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Location
    Modesto, CA US
    Posts
    1
    Rep Power
    0
    The problem, is you didn't quite get the right folder. For a servlet that will be accessed like http://192.168.0.1:8080/servlet/myservlet
    the file myservlet.class will need to be in
    /tomcat-root/webapps/ROOT/WEB-INF/classes
    of course replace tomcat-root with the location of your tomcat directory. I had the same problem when I first started, here is a link to the page I used to figure out where things go.

    http://www.tek271.com/articles/deplo...on_tomcat.html

    Oh, and be sure to shutdown the server and restart it if you just copy the file into the directory.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    10
    Rep Power
    0

    That helped


    Thanks for the link. It explained enough for me to get the standalone server working. Now I just need to figure out how to make it accessible from anywhere. I am looking at the tomcat.conf to see if I can do this.

    It seems like I would want to define a directory under which all my servlets can placed. I'll get it figured out, but its been confusing. Thanks again.

    Bob
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Location
    Modesto, CA US
    Posts
    1
    Rep Power
    0
    Are you using mod_jk? I found a couple web pages that go over implementing Tomcat with the requests being routed through Apache. Now I just need to implement it once I finish up with my servlet project.

    Map URLs to Servlets for Friendly Surfing
    and then the mod_jk if you aren't familiar with it
    mod_jk
    I hope these help.

IMN logo majestic logo threadwatch logo seochat tools logo