Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
How to run a servlet 
 

In this section, you will learn how to run servlets.

 

How to Run a Servlet

                         

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.

 

                         

» View all related tutorials
Related Tags: c ide orm table data form io make type column field name columns change this id nsis war tab row

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

4 comments so far (
post your own) View All Comments Latest 10 Comments:

while am compiling the servlet application am getting 6 errors

package javax.srvlet ; doesnot exist
package javax.servlet.http; doesnot exist
and so many errors

wat is my solution

plz give me reply

Posted by raja on Monday, 08.4.08 @ 12:32pm | #70910

while am compiling the servlet application am getting 6 errors

package javax.srvlet ; doesnot exist
package javax.servlet.http; doesnot exist
and so many errors

wat is my solution

plz give me reply

Posted by Parveen Sultana on Tuesday, 07.29.08 @ 19:31pm | #69808

The way sepcified the servlet is not running

Posted by venkata karthik R on Tuesday, 09.18.07 @ 07:03am | #27454

Very nice site with beautiful explanation ..... i like you very much.... thank you for this great job

Posted by Nitilaksha on Wednesday, 09.5.07 @ 15:24pm | #25087

Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.