In this tutorial we giving complete material on Servlet. You will learn Servlet in detail through detailed articles and examples.
In this tutorial we giving complete material on Servlet. You will learn Servlet in detail through detailed articles and examples. This Servlet tutorial is equally import for the beginners and experienced programmers. As a beginner you will find this tutorial a best getting started guide. As a experienced developer you will find the examples and explanation of advanced Servlet. Many examples provided here will be help you in finding the solution of common problem faced while programming in Servlet.
Things to know in advance:
You should have good core java programming language and the basic understanding of the web. It will be even better if are confirmable with the HTML. You should know the basics of HTML, create web pages and use the HTML user input tags.
Latest version of JDK at least JDK 5 must be installed and configured on your computer. We will be using Tomcat server to run the examples discussed here. So, you should have working knowledge of Tomcat Server. You are free to use other Servlet container such as Jetty, Apache Geronimo, GlassFish, Tiny Java Web Server etc..
Getting Started with Servlet
This Servlet tutorial is also a good starting guide for the beginners. You will learn how to write Servlet, compile, configure on Tomcat, start server and test the Servlet. We will also explain how you can recompile and test the Servlet if there is any error or code modification is needed.
Servlet is used for developing server side programs for a web application based on JAVA. Servlet is based on request response model which can handle any type of request but Servlet also provides Http specific API to handle Http request more efficiently and easily.
Previously CGI was the means of providing dynamic content. CGI was platform dependent and needs to recompile the programs in the new operating system, it is process based. But Servlet is platform independent because of Java's platform independent feature and is thread based. Servlet are more advantageous over CGI in terms of features like Platform Independence, Performance, Extensibility and Security etc.
Servlet runs on JVM on the server and so safe and portable. Servlet do not require java in web browser unlike Applets.
Servlet Container: A Servlet container is software program to load, initialize and execute Servlet.
The life cycle of a Servlet is processed in four steps:1. Loading and Instantiation
During startup or when the first request is made, the Servlet container loads the Servlet
The Servlet container passes the Servlet initialization parameters to the init() method.
Now Servlet container is ready to provide services of the Servlet so calls the service() method.
Servlet container calls the destroy() method to destroy the Servlet if no longer needed.
Let's get Started
Here is the topics in the Servlet Tutorial.
Some Basic Servlet Examples
Using Cookie with Servlet
Servlet with Database Basic works
Servlet with Database advance works
Ajax with Servlet