views:

141

answers:

2

I am new to java servlets. I learning from the basic. I have a simple servlet program, but i don't know how to run it.

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
 {
  PrintWriter out = response.getWriter();
  out.println("Hello World");
 }
}

How can run the above program in netbeans. I am using the netbeans6.8. Whats are the procedures which i have to follow? Thanks in Advance.

+1  A: 

You need to make sure you've created a web application project in Netbeans, then you should be able to run your Servlet as part of it. This guide is for Netbeans 5 but the principles should be still the same:

http://www.java-tips.org/java-tutorials/tutorials/introduction-to-java-servlets-with-netbeans.html

Jon
A: 

The Java EE and Java Web Learning trail should help you get started.

Amit