简体   繁体   中英

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

Java EE和Java Web Learning路径应该可以帮助您入门。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM