How to run the servlet program in NetBeans IDE?
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. What are the procedures which I have to follow?
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:
https://www.java-tips.org/java-tutorials/1506-introduction-to-java-servlets-with-netbeans.html]1
The Java EE and Java Web Learning trail should help you get started.
精彩评论