使用HttpServlet的三种方式
来源:互联网 发布:携程程序员怒删数据库 编辑:程序博客网 时间:2024/06/03 19:07
使用HttpServlet的三种方式
/** * 使用HttpServlet的三种方式 * 1、在get里面调用post * 2、在post里面调用get * 3、不管什么请求(post或get)。直接在service中执行就可以了 * * */public class TestHttpServlet extends HttpServlet{/** * */private static final long serialVersionUID = 1L;//1、在get里面调用post@Overrideprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {//this.doPost(req, resp);System.out.println("post里面调用get。。。。");}//2、在post里面调用get@Overrideprotected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {//System.out.println("get里面调用post。。。。");this.doGet(req, resp);}// 3、不管什么请求(post或get)。直接在service中执行就可以了@Overrideprotected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {// TODO Auto-generated method stubSystem.out.println("随便什么请求");}}
第三种(推荐):不管什么请求,直接在service中执行就可以了
阅读全文
0 0
- 使用HttpServlet的三种方式
- Action中获得HttpServlet信息三种方式
- Servlet(6)Servlet三种开发方式之继承GenericServlet、HttpServlet及get和post提交表单方式的区别
- Servlet系列之第三种创建方式(三)--实现HttpServlet类
- struts2获得HttpServlet对象的方式
- 使用WebPart的三种方式
- CSS的三种使用方式
- HTML使用CSS的三种方式
- webview的三种使用方式
- UIImageView 的三种使用方式
- linux使用帮助的三种方式
- struts2使用session 的三种方式
- Tomcat8使用数据源的三种方式
- js的三种使用方式
- 加载图片的三种方式使用
- PHP的三种使用方式
- CSS的三种使用方式
- c++三种使用shared_ptr的方式
- shell批量处理
- ubuntu 16.04 测试Kinect 1 保存深度图像
- Redis常用命令
- freemarker常用内置函数
- leetcode_112. Path Sum
- 使用HttpServlet的三种方式
- 表单判断(正则)
- jmeter个人学习之路--常见问题及解决方案
- Error:ERROR ITMS-90474: "Invalid Bundle. iPad Multitasking support requires these orientations:
- 如何转载别人CSDN上的博客
- android Kotlin: val和var的区别
- sql模糊查询查询多个关键字
- 基于element-ui封装的分页组件,功能齐全。
- android开发之&接口回调