这是我写的一个简单的servlet程序,但编译的时候,提示“doGet()”后面没有分号,
程序如下:
import java.io.*;
import javax.servlet.*;
public class HelloServlet extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throw IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<body>");
out.println("<head>");
out.println("<title>Hello Word!!!</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>this is my first servlet!!!</h1>");
out.println("</body>");
out.println("</html>");
}
}
补充:在这之前,我已经将tomcat6.0/lib下的servlet-api.jar复制到了.../jdk/lib目录下了。