Java Servlets are server side components that provides a powerful mechanism for developing server side of web application. Earlier CGI was developed to provide server side capabilities to the web applications. Although CGI played a major role in the explosion of the Internet, its performance, scalability and reusability issues make it less than optimal solutions. Java Servlets changes all that. Built from ground up using Sun's write once run anywhere technology java servlets provide excellent framework for server side processing.
With Java servlets web developers can create fast and efficient server side application and can run it on any Servlet enabled web server. Servlets runs entirely inside the Java Virtual Machine. Because the Servlet is running on the server side, it does not depend on browser compatibility. I just send the result in html formats.
Java Servlets have a number of advantages over CGI and other API's. They are:
Java Servlet APIJava Servlet API contains two core packages:
Servlets implement the javax.servlet.Servlet interface. The javax.servlet package contains the generic interfaces and classes that are implemented and extended by all servlets. While the javax.servlet.http package contains the classes that are used when developing HTTP - specific servlets. The HttpServlet is extended from GenericServlet base class and it implements the Servlet interface. HttpServlet class provides a framework for handling the HTTP requests.
The javax.servlet.Servlet defines five methods:
Installing ServletsThe servlet run inside a Web Server program. After it has been compiled, it must be installed onto Web Server in order to test it. Thus we have to follow the following steps:
Java servlets are supported by a number of web servers. Java Web Server from JavaSoft was first servlet enabled web server. Now a days a number of web server supports java servlets. In this article we will use Java Web Server, whose evaluation copy can be downloaded from http://jserv.javasoft.com . In order to compile your servlet you also need Java Servlet Development Kit (JSDK) which is available at same place.
Installing on Windows95 and Win NT
To run the Web Server go to your installation
directory and then to bin directory and then double click httpd.exe. To
test the Web Server open your browser and type http://localhost:8080
in address bar and then press enter. Browser should display default
index.html into browser.
If you enjoyed this post then why not add us on Google+? Add us to your Circles Liked it! Share this Tutorial Discuss: Accessing Database from servlets through JDBC!
View All Comments
Links To Servlets Tutorials
Posted on: January 30, 2005
Post your Comment
July 6, 2012
how to access data using JDBC
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial
Discuss: Accessing Database from servlets through JDBC!
View All Comments