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. } }
Join MindStick Community
You need to log in or register to vote on answers or questions.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
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.