1.哪些可以使用

  MVC中的Handler方法可以接受ServletAPI类型的参数。

  

2.controller

 package com.spring.it;

 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 ServletApiControl {
@RequestMapping("/helloworld6")
public void hello(HttpServletRequest request,HttpServletResponse response,Writer out) throws Exception {
System.out.println("request="+request);
System.out.println("response="+response);
out.write("Spring mvc");
}
}

3.index

 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<br>
<a href="helloworld6/">test servlet API</a>
</body>
</html>

4.效果

  

5.ps

  Writer的由来

  response.getWriter();

最新文章

  1. [转载]深入理解HTTP Session
  2. div模拟table,可实现左右高度同增长(html布局)
  3. PHP语法基础
  4. PHP的PSR系列规范都有啥内容
  5. Web安全之点击劫持(ClickJacking)
  6. Oracle窗口函数显示想要的行数
  7. poj3709
  8. 取PE文件的引入表和导出表
  9. [ERROR] Fatal error: Can&#39;t open and lock privilege tables: Table &#39;mysql.user&#39; doesn&#39;t exist 160913 02:11:21 mysqld_safe mysqld from pid file /tmp/mysql.pid ended
  10. MTK如何烧录IMEI码(俗称串号)
  11. [目录]搭建一个简单的WebGIS应用程序
  12. ⌈洛谷4735⌋⌈BZOJ3261⌋最大异或和【可持久化01Trie】
  13. 使用GeoServer导出地图数据GeoJSON并应用
  14. HDU 4825 Xor Sum (模板题)【01字典树】
  15. 利用docker搭建ubuntu+nginx+PHP容器
  16. Scrapy实战篇(五)之爬取历史天气数据
  17. 选择困难症的福音——团队Scrum冲刺阶段-Day5(补发 那天csshow)
  18. BZOJ1468Tree——点分治
  19. js fetch api
  20. linux系统下pdf操作软件pdftk

热门文章

  1. 二、主目录 Makefile 分析(2)
  2. dijkstra补充
  3. asp.net mvc简单分页实例
  4. pygame中多个class类之间的关系
  5. 【转贴】Linux下MySQL 5.5的修改字符集编码为UTF8(彻底解决中文乱码问题)
  6. mongodb系列~关于双活状态的mongodb集群
  7. 2018-2019-2 《网络对抗技术》Exp0 Kali安装 Week1 20165320
  8. 原生JS给元素添加class属性
  9. word打不开怎么办?
  10. STOMP Over WebSocket