Java Servlets

Total Post:113

Java  Javac 
 239  View(s)
Rate this:

What are Java Servlets ?

  1. Post:140

    Re: Java Servlets

    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 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
          // Actual logic goes here. PrintWriter out = response.getWriter();
          out.println("<h1>" + message + "</h1>");
       } public void destroy() {
          // do nothing.