Introduction to Servlets

Introduction to Servlets

Java servlets are Java’s technology for developing dynamic web applications.

Technically, servlets are java classes that conform to the Java Servlet API.

Servlet API allows java classes to respond to different types of requests; however, the most popular is HTTP requests.

Since servlet is a java class, you can write any valid java code within a servlet. 

First servlet specification was released in 1997 and current servlet specification version 3.1 (as of this writing) was released as part of Java EE 7.

A servlet container usually implements a particular version of the servlet specification. You can read more about servlet containers and application containers @ Web Server, Web Container and Application Server.

For a servlet and JSPs to respond to requests, unlike normal java classes, servlets should be deployed to a servlet container like Apache Tomcat or an Application Sever like JBoss, which also contains the servlet container.

While developing a servlet you can add your servlet implementation class from your servlet container to classpath. In case of Apache Tomcat, it is the servlet-api.jar in the lib folder. 

Your web browser will by default only understand language independent client side technologies such as html, javascript, css etc.

A server side technology such as servlet, JSP, PHP or ASP eventually sends html to the browser. There are excpetions to this rule as in case of technologies like applets, javafx, adobe flex etc. where language specific code is sent to the browser; however for these technologies to work, corresponding libraries need to be installed in the browser like java for applets and flash player for flex.

Comments

RaghuVarma's picture

can you email me the servlets and jsp notes email:varma.pinnelli@gmail.com

Was it useful?

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!