简体   繁体   English

如何在NetBeans IDE中运行servlet程序?

[英]How to run the servlet program in NetBeans IDE?

I am new to java servlets. 我是Java servlet的新手。 I learning from the basic. 我从基础学习。 I have a simple servlet program, but I don't know how to run it. 我有一个简单的servlet程序,但是我不知道如何运行它。

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. 如何在NetBeans中运行以上程序。 I am using the netbeans6.8. 我正在使用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. 您需要确保已在Netbeans中创建了一个Web应用程序项目,然后您应该能够在其中运行Servlet。 This guide is for Netbeans 5 but the principles should be still the same: 本指南适用于Netbeans 5,但原理应相同:

https://www.java-tips.org/java-tutorials/1506-introduction-to-java-servlets-with-netbeans.html] 1 https://www.java-tips.org/java-tutorials/1506-introduction-to-java-servlets-with-netbeans.html] 1

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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