• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

using "Professional Java Servltes 2.3"

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyone out there who is using "Professional Java Servlets 2.3" from Wrox, if so did you have a problem when running the first example as setup on page 55 - I can get it to work if i set it up in my ROOT directory but not in servletAPI as he suggests. I have the TOMCAT 4 server configured as suggested in the Jakarta tomcat literature - i think. thanking you
tom
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For those of us that don't have the book, can you give us a few details?
 
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tom,
If the example works under the ROOT directory then it sounds like you're having problems with configuration/deployment.
What does your servletAPI directory look like, and did you restart Tomcat after creating the servletAPI "web application"?
Simon
 
tom mcmorrow
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi mike & simon
sorry for the delay in replying to your postings but i was away for the weekend. here is my setup for Tomcat server.I have
c:\
jakarta_tomcat_4.0\
webapps\
ROOT\
WEB-INF\
classes\
basicServlets\
BasicServlet
the url I use is - http://localhost:8080/servlet/basicServlets.BasicServlet
Like this it works.
However i feel from the instructions in the book i should have.
c:\
jakarta_tomcat_4.0\
webapps\
ServletAPI\
WEB-INF\
classes\
basicServlets\
BasicServlet
using the following url -
http://localhost:8080/ServletAPI/servlet/basicServlets.BasicServlet
however it doesnt work.

i think the servlet directory must be somehow used by the server but it does not appear in the drectory tree anywhere.
i hope the directory tree is comprehendable when HTML gets through with it
Thanking you for your help.
tom
[ April 28, 2002: Message edited by: tom mcmorrow ]
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's the 'quick and easy' way to deploy servlets, which is the approach taken in your book.

In short, when Tomcat receives '/servlet/' in any request, it invokes a class that goes and finds the appropriate servlet. This is work that it wouldn't have to do though, if you provided your own, more portable mappings.

As a very quick example for mappings,
Now if I define those entries inside my web.xml in the ServletAPI/WEB-INF directory, then
http://localhost:8080/ServletAPI/foo should invoke the servlet com.my.bar.foo

Doing it this way has the added advantage of 'hiding' your packaging and class name. (I can choose anything I want for "servlet-name" and "url-pattern")

For more info on how Tomcat does the magic with /servlet, open up <CATALINA_HOME>/conf/web.xml This file is heavily commented. Pay attention to the built in servlet definitions (the invoker starts around line 60) and the mappings (starting around line 234)

This file is very instructive both for how Tomcat provides the /servlet mapping service, and for how you should build your own web.xml
[ April 28, 2002: Message edited by: Mike Curwen ]
 
tom mcmorrow
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi mike
By careful application of the logic outlined by you above i seem to have overcome my difficulties.
Thanking you
tom
 
Think of how stupid the average person is. And how half of them are stupider than that. But who reads this tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic