SpringMVC(十三) RequestMapping 使用servlet原生API作为参数
SpringMVC支持以下Servlet方法:
HttpServletRequest
HttpServletResponse
HttpSession
Writer
Reader
Locale
InputStream
OutputStream
java.security.Principal
控制器参考代码:

package com.tiekui.springmvc.handlers; import java.io.IOException;
import java.io.Writer; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; @Controller
public class ServletApiTest { @RequestMapping("testServerletApi")
public void testServerletApi(HttpServletRequest request,HttpServletResponse response,Writer writer) {
System.out.println("request:" + request + ",response " + response);
try {
writer.write("Hello,This is a servlet writer response");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

视图代码:
<a href="testServerletApi">Test Servlet Api Video 13</a>
SpringMVC(十三) RequestMapping 使用servlet原生API作为参数的更多相关文章
- springmvc使用pojo和servlet原生api作为参数
一.Pojo作为参数: 实体: package com.hy.springmvc.entities; public class User { private String username; priv ...
- SpringMVC 使用Servlet原生API作为参数
具体看代码: @RequestMapping("/testServletAPI") public void testServletAPI(HttpServletRequest re ...
- Spring MVC 使用Servlet原生API作为参数
具体看代码: @RequestMapping("/testServletAPI") public void testServletAPI(HttpServletRequest re ...
- SpringMVC(八):使用Servlet原生API作为Spring MVC hanlder方法的参数
在SpringMVC开发中,是有场景需要在Handler方法中直接使用ServletAPI. 在Spring MVC Handler的方法中都支持哪些Servlet API作为参数呢? --Respo ...
- SpringMVC之使用Servlet原生API作为参数
SpringMVC的handler接收如下的ServletAPI类型的参数: • HttpServletRequest • HttpServletResponse • HttpSession • ja ...
- 注解 @RequestParam,@RequestHeader,@CookieValue,Pojo,servlet原生API
1.@RequestParam 我们的超链接:<a href="springMvc/testRequestParam">testRequestParam</a&g ...
- 获取Servlet原生API
1.请求 <a href="param/test1">Servlet原生API</a> 2.处理方法 @RequestMapping("/para ...
- SpringMVC 支持使用Servlet原生API作为目标方法的参数
具体支持一下类型: * HttpServletRequest * HttpServletResponse * HttpSession * java.security.Pricipal * Locale ...
- 【SpringMVC】---RequestMapping、Ant 路径、PathVariable 注解、HiddenHttpMethodFilter 过滤器、用 POJO 作为参数
一.web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi=&qu ...
随机推荐
- Vue+restfulframework示例
一.简单回顾vue 前不久我们已经了解了vue前端框架,所以现在强调几点: 修改源: npm config set registry https://registry.npm.taobao.org 创 ...
- linux用户
hen we are travelling, we find ourselves in new places and new spaces, physically and internally; it ...
- Python基础知识之大杂烩
一.range 和 xrange 的区别 xrange 与 range 基本上都是在循环的时候用,两者的用法完全相同.所不同的是xrange生成的是一个生成器,而range生成的是一个list对象. ...
- Nginx详解二十二:Nginx深度学习篇之Lua解释器安装及基础语法
解释器 Lua:Lua是一个简洁.轻量.可扩展的脚本语言 Nginx+Lua优势充分的结合Nginx的并发处理epoll优势的Lua的轻量实现简单的功能切高并发的场景 安装Lua 1.安装解释器:yu ...
- 模块(import语句,from...import语句,_name_属性)
1, 什么是模块? 模块就是一系列功能的集合体 模块分为四个通用的类别: 1), 使用python编写的.py文件(*****) 2), 已被编译为共享库或DLL的C或C++扩展 3), 把一系列模块 ...
- 多版本python安装第三方库
1.先进入对应版本的python 2.使用命令安装:./pip install xxx
- 配置webpack loader vue 报错:Module build failed: TypeError: this._init is not a function
单文件组件 引入时报错 配置webpage.config.js中的vue 需要如下写法 { test: /\.vue/, loader: "vue-loader", } 之前写的l ...
- oa项目环境搭建的操作步骤详解
dto:多表关联查询用单独建一个类,把查询数据放dto即可 vo:是view的缩写.单独定义一个类
- Cannot uninstall 'html5lib'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
如标题,安装Tensorflow-gpu时遇到的完整问题 Cannot uninstall 'html5lib'. It is a distutils installed project and th ...
- config.GetSection(key)编译不通过
要安装这个版本