SpringMVC 支持使用Servlet原生API作为目标方法的参数
具体支持一下类型:
* HttpServletRequest
* HttpServletResponse
* HttpSession
* java.security.Pricipal
* Locale
* InputStream
* OutputStream
* Reader
* Writer
代码示例:
index.jsp:
<a href="springmvc/testServletAPI"> test ServletAPI</a>
@Controller:
@RequestMapping("/testServletAPI")
public void testServletAPI(HttpServletRequest request,HttpServletResponse response,Writer w) throws IOException{
System.out.println("testServletAPI request: " + request + ",response: " + response);
w.write("Hello SpringMVC!");
// return SUCCESS;
}