【Java】【web】Servlet的三种编写方式(HttpSe
作者:
JerichoPH | 来源:发表于
2017-04-09 18:08 被阅读49次
Servlet的三种编写方式(HttpServlet)
/**
* HttpServlet(模板设计模式)
*
* @author JerichoPH
*/
public class ServletDemo3 extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
System.out.println("**********GET**********");
System.out.println(req.getRemoteAddr()); // 获取访问者地址信息
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
System.out.println("**********POST**********");
}
}
本文标题:【Java】【web】Servlet的三种编写方式(HttpSe
本文链接:https://www.haomeiwen.com/subject/joodattx.html
网友评论