Answer Posted / vivek
To run a servlet one should follow the steps illustrated below:
Download and Install the tomcat server: Install the tomcat server in a directory in which you want to install and set the classpath.for the variable JAVA_HOME in the environment variable. To get details about the installation process and setting the classpath click the link Tomcat installation.
Set the class for the jar file: Set the classpath of the servlet-api.jar file in the variable CLASSPATH inside the environment variable by using the following steps.
For Windows XP,
Go to Start->Control Panel->System->Advanced->Environment Variables->New button and Set the values as
Variable Name: CLASSPATH
Variable Value: C:\Program Files\Java\Tomcat 6.0\lib\servlet-api.jar
For Windows 2000 and NT
Go to Start->Settings->Control Panel->System->Environment Variables->New button and Set the values as
Variable Name: CLASSPATH
Variable Value: C:\Program Files\Java\Tomcat 6.0\lib\servlet-api.jar
Create a java source file and a web.xml file in a directory structure.
Compile the java source file, put the compiled file (.class file) in the classes folder of your application and deploy the directory of your application in the webapps folder inside the tomcat directory.
Start the tomcat server, open a browser window and type the URL http://localhost:8080/directory (folder name of your application) name/servler name and press enter.
If everything is correct your servlet will run.
| Is This Answer Correct ? | 8 Yes | 5 No |
Post New Answer View All Answers
Why do you use session tracking in httpservlet?
In the servlets, we are having a web page that is invoking servlets ,username and password? which is checks in database? Suppose the second page also if we want to verify
List out the difference between ServletConfig and ServletContext?
What is the need of session tracking in web application?
What is the servletconfig object?
What is the major difference between servlet and applet?
What are the objects involved when a servlet receives a call from client?
Why don't we write a constructor in a servlet?
What is servlet invoker?
What are the features added in Servlet 2.5?
What is new in ServletRequest interface ? (Servlet 2.4)
How do you design microservices?
What is the difference between 2 types of servlets?
What is servlet and its life cycle?
what do you understand by url rewriting?