wat exactly servlets are?
how r they used in java?
wat r the real benefits by using java servlets?
give a detailed theory and example for servlets in simpler words.

In simple words , the client requests that some action be performed and the server performs the action and responds to the client. This request-response model of communication is the foundation for the highest level views of networking in java i.e., serlets and Java Server Pages. Servlet extends the functionality of a server. :idea: understand

Servlet is a program resides in server (web server like tomcat) and when ever a request comes from a client (web browser) servlet responds and sends back the response.
The live example is you have posted a question here and this web site has put your question on this page this nothing but a servlet is taking your request and putting it on the this page.

ok...
Bye

I can only add this:
a JSP (Java Server Page) is compiled to a servlet the first time you run it ;-)

so they are all servlets (server extensions :-))

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.