hardik hardik - 4 months ago 58
Java Question

What is Java Servlet?

I read many articles to understand java servlet but I did not succeed.

Can you please give brief introduction of java servlets (in easy language).
Like what is servlet? What are the advantges? And all that.

I can't understand the difference between server-side programming languages (PHP, ASP) and servlets.


A servlet is simply a class which responds to a particular type of network request - most commonly an HTTP request. Basically servlets are usually used to implement web applications - but there are also various frameworks which operate on top of servlets (e.g. Struts) to give a higher-level abstraction than the "here's an HTTP request, write to this HTTP response" level which servlets provide.

Servlets run in a servlet container which handles the networking side (e.g. parsing an HTTP request, connection handling etc). One of the best-known open source servlet containers is Tomcat.