Pin It

How to create simple Hello World Servlet application in Java ?

Program to demonstrate working of a simple Hello World servlet

package com.hubberspot.servlet.example;

import java.io.*; 
import javax.servlet.*;
import javax.servlet.http.*;

public class HelloWorld extends HttpServlet 
{
  public void doGet(HttpServletRequest request, 
          HttpServletResponse response) 
          throws ServletException, IOException 
{
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("

Hello World

"); 
  }
}

Output of the program on the web browser :


Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Related Posts Plugin for WordPress, Blogger...

Post your related queries below ...

comments powered by Disqus
Powered by Blogger.
 
© 2012 Learn Java by Examples Template by Hubber Spot