java – servlet doGet和doPost方法

栏目: Java · 发布时间: 7年前

内容简介:简单地说,就是使servlet一般化,这样即使我们将来更改请求方法,也不需要编辑servlet,这将减少将来修改应用程序的工作量.翻译自:https://stackoverflow.com/questions/9148399/servlet-doget-and-dopost-methods

参见英文答案 > doGet and doPost in Servlets 5个

我想知道在servlet中为什么我们在同一个程序中一起使用doGet和doPost方法.有什么用?

以下代码的含义是什么?

为什么要从doPost调用doGet方法?我对这段代码一点也不清楚.

public class Info extends HttpServlet
{

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
 {

 }


public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
    doGet(request, response);
}
}

谢谢

简单地说,就是使servlet一般化,这样即使我们将来更改请求方法,也不需要编辑servlet,这将减少将来修改应用程序的工作量.

翻译自:https://stackoverflow.com/questions/9148399/servlet-doget-and-dopost-methods


以上所述就是小编给大家介绍的《java – servlet doGet和doPost方法》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Lean Analytics

Lean Analytics

Alistair Croll、Benjamin Yoskovitz / O'Reilly Media / 2013-3-18 / USD 29.99

If you're involved with a startup, analytics help you find your way to the right product and market before the money runs out. But with a flood of information available, where do you start? This book ......一起来看看 《Lean Analytics》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具