为什么会系统不识别getWriter()方法
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class Ch1Servlet extends HttpServlet
{
public void doGet(HttpServletRequest request,HttpServletRequest response)throws
IOException {
PrintWriter out=response.getWriter();
java.util.Date today=new java.util.Date();
out.println(
"<html>"+
"<body>"+
"<h1 align=center>HF\'s Chapter1 Servlet</h1>"
+"<br>"+today+"</body>"+"</html>");
}
}
报错:
D:\Servlets and JSP\project1\src\Ch1Servlet.java:9: 找不到符号
符号: 方法 getWriter()
位置: 接口 javax.servlet.http.HttpServletRequest
PrintWriter out=response.getWriter();
^
1 错误
工具以退出代码 1 完成
那位帅哥帮我看下,我是初学者,谢谢。
------解决方案--------------------
别瞎扯
lz,你代码写错了
你的public void doGet(HttpServletRequest request,HttpServletRequest response)throws IOException
应该是HttpServletResponse