博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【SpringMVC】适配器
阅读量:2056 次
发布时间:2019-04-28

本文共 536 字,大约阅读时间需要 1 分钟。

适配器:

Action实现Controller接口

org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter

作用:用于定位控制器的,即用于找到实现Controller接口的Action类

public class UserAction implements Controller{	@Override	public ModelAndView handleRequest(HttpServletRequest request,			HttpServletResponse response) throws Exception {		//ModelAndView表示向视图封装数据和真实路径		ModelAndView modelAndView = new ModelAndView();		modelAndView.addObject("message","操作用户");		//modelAndView.setViewName("/jsp/success.jsp");		modelAndView.setViewName("success");		return modelAndView;	}}

转载地址:http://bdslf.baihongyu.com/

你可能感兴趣的文章
web.xml配置监听器,加载数据库信息配置文件ServletContextListener
查看>>
结构型模式之桥接模式(Bridge)
查看>>
行为型模式之状态模式(State)
查看>>
行为型模式之策略模式(Strategy)
查看>>
行为型模式之模板方法模式(TemplateMethod)
查看>>
行为型模式之访问者模式(Visitor)
查看>>
大小端详解
查看>>
source insight使用方法简介
查看>>
<stdarg.h>头文件的使用
查看>>
C++/C 宏定义(define)中# ## 的含义 宏拼接
查看>>
Git安装配置
查看>>
linux中fork()函数详解
查看>>
C语言字符、字符串操作偏僻函数总结
查看>>
Git的Patch功能
查看>>
分析C语言的声明
查看>>
TCP为什么是三次握手,为什么不是两次或者四次 && TCP四次挥手
查看>>
C结构体、C++结构体、C++类的区别
查看>>
进程和线程的概念、区别和联系
查看>>
CMake 入门实战
查看>>
绑定CPU逻辑核心的利器——taskset
查看>>