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作为参数的更多相关文章

  1. springmvc使用pojo和servlet原生api作为参数

    一.Pojo作为参数: 实体: package com.hy.springmvc.entities; public class User { private String username; priv ...

  2. SpringMVC 使用Servlet原生API作为参数

    具体看代码: @RequestMapping("/testServletAPI") public void testServletAPI(HttpServletRequest re ...

  3. Spring MVC 使用Servlet原生API作为参数

    具体看代码: @RequestMapping("/testServletAPI") public void testServletAPI(HttpServletRequest re ...

  4. SpringMVC(八):使用Servlet原生API作为Spring MVC hanlder方法的参数

    在SpringMVC开发中,是有场景需要在Handler方法中直接使用ServletAPI. 在Spring MVC Handler的方法中都支持哪些Servlet API作为参数呢? --Respo ...

  5. SpringMVC之使用Servlet原生API作为参数

    SpringMVC的handler接收如下的ServletAPI类型的参数: • HttpServletRequest • HttpServletResponse • HttpSession • ja ...

  6. 注解 @RequestParam,@RequestHeader,@CookieValue,Pojo,servlet原生API

    1.@RequestParam 我们的超链接:<a href="springMvc/testRequestParam">testRequestParam</a&g ...

  7. 获取Servlet原生API

    1.请求 <a href="param/test1">Servlet原生API</a> 2.处理方法 @RequestMapping("/para ...

  8. SpringMVC 支持使用Servlet原生API作为目标方法的参数

    具体支持一下类型: * HttpServletRequest * HttpServletResponse * HttpSession * java.security.Pricipal * Locale ...

  9. 【SpringMVC】---RequestMapping、Ant 路径、PathVariable 注解、HiddenHttpMethodFilter 过滤器、用 POJO 作为参数

    一.web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi=&qu ...

随机推荐

  1. python之多线程通信

    共享变量通信 事实上共享变量通信是会造成线程安全的,除非我们对这个共享变量是有足够了解的,如非必要就不要使用共享变量在线程间进行通信 Queue通信 理解不深入,暂不写

  2. Vue2 Virtual DOM

    vue 虚拟dom 的重点 是以 javascript 对象模拟 dom 节点. //用Javascript代码表示DOM节点的伪代码 Let domNode = { tag: 'ul' attrib ...

  3. SpringBoot捕获全局异常

    1.创建GloableExceptionAop类捕获全局异常 package com.cppdy.exception; import org.springframework.web.bind.anno ...

  4. 用flask实现的添加后保留原url搜索条件

    1.具体实现 #!usr/bin/env python # -*- coding:utf-8 -*- from flask import Flask,render_template,request,r ...

  5. 2017-2018-2 20165314实验二《Java面向对象程序设计》实验报告

    实验报告封面 实验一 实验要求 参考 http://www.cnblogs.com/rocedu/p/6371315.html#SECUNITTEST 完成单元测试的学习提交最后三个JUnit测试用例 ...

  6. Spring Boot的Listener机制的用法和实现原理详解

    之前在介绍了在spring-boot启动过程中调用runner的原理,今天我们介绍另外一种可以实现相似功能的机制:spring-boot的Listener机制. 通过注册Listener,可以实现对于 ...

  7. Python 读写excel类

    #-*- coding: utf8 -*- import xlrd import xlwt from Public import GlobalClass def openexcel(path): tr ...

  8. Java接口自动化测试之TestNG学习(二)

    在maven项目的pom.xml文件中导入TestNG <?xml version="1.0" encoding="UTF-8"?> <pro ...

  9. 【TensorFlow】基于ssd_mobilenet模型实现目标检测

    最近工作的项目使用了TensorFlow中的目标检测技术,通过训练自己的样本集得到模型来识别游戏中的物体,在这里总结下. 本文介绍在Windows系统下,使用TensorFlow的object det ...

  10. expect 安装 salt 客户端

    #!/bin/bash for i in $(cat ./host.txt) do echo $i > ./tmp.txt HOSTNAME=$(cut -d ':' -f1 ./tmp.txt ...