Sponsers

Archives

Posts in category Servlet Tutorials

Servlet is a server side scripting technology , which allows you to create dynamic websites.

Servlet is a technology introduced by Java to overcome the drawbacks of existing technologies like CGI (Common Gateway Interface).

Servlet differs from CGI in a sense that it doesn’t create separate Process for each of the client connected , rather it creates a separate Thread. Threads are easier to maintain , Thus it becomes fast and improves performance.

Servlet is basically a Java Class which uses Servlet APIs .

Servlet has a Life – Cycle which consists of 3 phases:

i. Init() – Servlet is invoked for first time.

ii. Service() – It fulfills requests of client.

iii. Destroy() – As name suggests after work is done servlet is destroyed.

For creation of servlet we need JDK i.e. Java Development Kit , along with Usually Apache Tomcat server is preferred.

Next step is to run the downloaded setup , and accept the license. It will show you choose component Window , select all boxes there, as shown in picture.

Next step is press next, it will install the tomcat, it will ask for port, keep it 8080 ( which will be present default), and username, password, username will be admin by default and password would be blank. You can keep same , or put whichever you need.

tomcat username password and port setting

Finally at the end, you can check if installation was successful or not by visiting

And then we are Done :) . If we setup environmental variables, it’s not required to set these variables again and again. And you can compile any number of servlets , present in any directory. Now in next tutorial , we will create our first Servlet.