Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2006

Tip: Looking for answers? Try searching our database.

servlet 101 question

Thread view: 
coltrane - 03 Sep 2006 14:51 GMT
I am attempting to write an HelloWorld servlet with tomcat and of
course I can't get it to work.
I am trying to run the first servlet from the CoreServlets book.
according to the book I can create a directory, place the servlet class
file, in the directory and invoke it in a browser. I compiled the
servlet and I placed it in a directory under the webapps directory.
Well of course this didn't work.
so where should I place the class file???.
btw, I was able to place a plain html file in the directory and get it
to run.

I am running tomcat 5.5 with winxp.

thanks for the help

john
coltrane - 03 Sep 2006 15:15 GMT
Okay, so I figured it out. I needed to create a web-inf directory and
use a web.xml file.
Strange this isn't mentioned for the first example in the book.

thanks

> I am attempting to write an HelloWorld servlet with tomcat and of
> course I can't get it to work.
[quoted text clipped - 12 lines]
>
> john
Juha Laiho - 03 Sep 2006 17:07 GMT
"coltrane" <tendengarci@yahoo.com> said:
>Okay, so I figured it out. I needed to create a web-inf directory and
>use a web.xml file.
>Strange this isn't mentioned for the first example in the book.

Older versions of Tomcat (3.3 or so) did not require a WEB-INF/web.xml;
current ones (I think at least from 4.0 onwards) do. WEB-INF/web.xml is
a requirement of the servlet specification, so the current behaviour
is correct (even though it requires a bit more work).

I guess the Core Servlets book is written for Tomcat 3.3 (if so, it also
lacks information on some of the changes in later servlet specification
versions).
Signature

Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
        PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)

Mark Space - 03 Sep 2006 18:48 GMT
> I guess the Core Servlets book is written for Tomcat 3.3 (if so, it also
> lacks information on some of the changes in later servlet specification
> versions).

Good point.  O'Reilly's Head First Servlets and JSP has correct
information for deployment and other niceties.  I found it very
accurate, and it has a lot of info too.  If the OP wants to pick up a
more up-to-date book, I'd recommend HFSJ.
coltrane - 05 Sep 2006 03:11 GMT
thanks to both for the info.
I'm off to bookpool :)

cheers

> > I guess the Core Servlets book is written for Tomcat 3.3 (if so, it also
> > lacks information on some of the changes in later servlet specification
[quoted text clipped - 4 lines]
> accurate, and it has a lot of info too.  If the OP wants to pick up a
> more up-to-date book, I'd recommend HFSJ.
Juha Laiho - 05 Sep 2006 18:47 GMT
"coltrane" <tendengarci@yahoo.com> said:
>> > I guess the Core Servlets book is written for Tomcat 3.3 (if so, it also
>> > lacks information on some of the changes in later servlet specification
[quoted text clipped - 7 lines]
>thanks to both for the info.
>I'm off to bookpool :)

Note also, that there are online resources to help you get started as well.

To get the basics on Tomcat, there is the "First Webapp" chapter
(http://tomcat.apache.org/tomcat-5.5-doc/appdev/index.html) in
the documentation. This'll guide through creating and deploying
a simple webapp, while also describing the basics of a typical
development environment.

Then, looking from the other side, the Java EE tutorials from Sun contain
good information on the different technologies, such as servlets, JSP
and so on;
http://java.sun.com/javaee/reference/tutorials/
especially
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/Overview7.html#wp79959
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/Overview7.html#wp79962
Signature

Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
        PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)

coltrane - 08 Sep 2006 14:09 GMT
excellent! the tutorials looks like a great resource

> "coltrane" <tendengarci@yahoo.com> said:
> >> > I guess the Core Servlets book is written for Tomcat 3.3 (if so, it also
[quoted text clipped - 29 lines]
>          PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
> "...cancel my subscription to the resurrection!" (Jim Morrison)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.