File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Simple servlet implementation
Joined: Feb 24, 2006
Feb 24, 2006 06:35:00
I am a beginner in the
world. I have installed Tomcat4.1 in my computer. Can any one tell me how to implement the "Helloworld" servlet with a link to a simple html "submit" button? It would be a great help for a beginner.
Joined: Jul 26, 2005
Feb 24, 2006 08:14:00
I would recommend you to read the Head First
In short though, you need to set up TOMCAT_HOME, JAVA_HOME in your environment variables. Google for more info on those variables.
You need to have a Deployment Descriptor named web.xml which provides the mapping between your form(HTML page) and the Servlet.
more info :
Joined: May 09, 2002
Feb 24, 2006 10:21:00
1) in the webapps folder make "mysite" folder, in that make "WEB-INF" folder and in that classes forlder
2) create a simple html file with action set to "http://localhost:8080/mysite/servlet/HelloServlet" and save it as index.html
the code will be...
<form action="http://localhost:8080/mysite/servlet/HelloServlet" method=get>
<input type=submit value="Go To Servlet">
3) create and compile a simple servlet
This servlet must have a doGet() method which print out the "Hello World"
message to client. This servlet class has to be in classes folder.
4) have web.xml (web descriptor) file in WEB-INF folder
5) go to your html page by typing
in the web browser after starting
For details do read the recommended book...
Help gets you when you need it!
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
subject: Simple servlet implementation
how to build a ajax response
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015