Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlets..

 
Chuck Meduri
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to Servlets and trying to learn this topic along with JSP. I have downloaded the Servlet 2.3 specification and I assume the JSP 1.2 comes along with it. I have also downloaded the Tomcat 3.1,3.2 and 4.0 versions. I have the Core Servlets and Java Server Pages book by Marty Hall. I have been trying to set up the Tomcat by following the book but haven't been sucessful at all. I copied the Hello World servlet program and tried executing it, but it gives me Http error code of 405. This is after setting up the Tomact 3.1 version. Could somebody help me with installation of the Tomcat(latest version would be good) and why I am getting this error?
Thank you very much,
Chuck
 
David Li
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you think the tomcat setting is correct, you should make sure that the class you compiled was in the right folder under webapps then web-inf then classes.
 
Chuck Meduri
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by David Li:
If you think the tomcat setting is correct, you should make sure that the class you compiled was in the right folder under webapps then web-inf then classes.

The class that I compiled is under webapps\web-inf\classes as described in the text book that I mentioned in my question.
 
P SOLAIAPPAN
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
For Tomcat 3.2 keep your html & jsp files in
"D:\jakarta-tomcat\webapps\ROOT" directory (here my installation dir is "d:\jakarta-tomcat" )
to run html/jsp file.
"http://localhost:8080/Hello.jsp "
or
"http://localhost:8080/Hello.jsp "

To run servlets keep your compiled servlets files in
"D:\jakarta-tomcat\webapps\ROOT\WEB-INF\classes" dir
To run "Hello.class" (servlet file)
"http://localhost:8080/servlet/Hello "
solaiappan
 
Chuck Meduri
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by P SOLAIAPPAN:
hi,
For Tomcat 3.2 keep your html & jsp files in
"D:\jakarta-tomcat\webapps\ROOT" directory (here my installation dir is "d:\jakarta-tomcat" )
to run html/jsp file.
"http://localhost:8080/Hello.jsp "
or
"http://localhost:8080/Hello.jsp "

To run servlets keep your compiled servlets files in
"D:\jakarta-tomcat\webapps\ROOT\WEB-INF\classes" dir
To run "Hello.class" (servlet file)
"http://localhost:8080/servlet/Hello "
solaiappan

I typed in http://localhost/servlet/HelloWorld which is the name of my servlet just like it was descibed in the book.
Any other suggestions would be appreciated
Thank you,
Chuck
 
Noah Carroll
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is very important the you type :8080 after localhost. If not, then it will not work. However, I have heard that if you change the port number in your server.xml file from 8080 to just 80 it will work as http://localhost/servlet/ServletName
------------------
I hope its helps, feel free to email me noahcarroll@juno.com
[This message has been edited by Noah Carroll (edited November 30, 2000).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic