URL: tutorials I refer to
I typed the code according to the tutorial I referenced.
first, the java code is:
//java
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
//HttpServlet
public class HelloWorld extends HttpServlet {
private String message;
public void init() throws ServletException
{
//
message = "Hello World";
}
public void doGet(HttpServletRequest request,HttpServletRequest response) throws ServletException,IOException {
//
response.setContentType("text/html");
//
PrintWriter out = response.getWriter();
out.println("<h1>" + message + "</h1>");
}
public void destroy()
{
//
}
}
After compiling this code successfully, I followed the tutorial and put the class file into < Tomcat-installation-directory > / webapps/ROOT//WEB-INF/classes (there is no classes folder under the WEB-INF file, and then I created a new one myself)
xml
Tomcatbinstartup.up
:http://localhost:8080/HelloWorld
:
tomcat
so I"d like to ask what the problem is.