---
title: "Java Servlets"  
description: "Java Servlets"  
author: "Anonymous User"  
published: 2018-07-07  
updated: 2018-07-09  
canonical: https://www.mindstick.com/forum/34591/java-servlets  
category: "java"  
tags: ["java", "javac"]  
reading_time: 1 minute  

---

# Java Servlets

What are [Java](https://www.mindstick.com/articles/12214/web-development-company-in-india-laid-on-the-foundation-of-concrete-java-programming) Servlets ?

## Replies

### Reply by Prakash nidhi Verma

Java Servlets :

A programs that run on a Web and Application server is callled Java servelts which is act as a middle layer between a request coming from a Web browser or other HTTP client and Database. we can directly collect input from users through web page forms by using servlet

- Common Gateway Interface (CGI).

- Performance is significantly better.

- Servlets execute within Web server space.

- Its security test is good and its having independent platform.

```
import java.io.*; import javax.servlet.*;import javax.servlet.http.*;
// Extend HttpServlet class
public class HelloWorld extends HttpServlet {   private String message;   public void init() throws ServletException {      // Do required initialization      message = "Mindstick";   }   public void doGet(HttpServletRequest request, HttpServletResponse response)      throws ServletException, IOException {      // Set response content type      response.setContentType("text/html");      // Actual logic goes here.
PrintWriter out = response.getWriter();      out.println("<h1>" + message + "</h1>");   }
public void destroy() {      // do nothing.   }}
```


---

Original Source: https://www.mindstick.com/forum/34591/java-servlets

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
