Spring MVC framework[2] Controller
来源:互联网 发布:手机淘宝免费注册账号 编辑:程序博客网 时间:2024/05/17 04:53
All contents are referenced from Spring in Action
Controller Class:
//@Controller annotation indicates that this class is a controller class. This annotation// is a specialization of the @Component annotation, which means that <context:component-scan>// will pick up and register @Controller-annotated classes as beans,// just as if they were annotated with @Component. @Controllerpublic class HomeController {public static final int DEFAULT_SPITTLES_PER_PAGE = 25;private SpitterService spitterService;@Inject //inject service public HomeController(SpitterService spitterService) {this.spitterService = spitterService;}@RequestMapping({"/","/home"}) //request-handling method, the annotation Mapping URL to handlerpublic String showHomePage(Map<String, Object> model) {model.put("spittles", spitterService.getRecentSpittles(DEFAULT_SPITTLES_PER_PAGE));return "home"; //return view name to DispatcherServlet so that it can use the name to consult View Resolver for real<span style="white-space:pre"></span>// view implementation}}XXX-context.xml
<!-- Enables the Spring MVC @Controller programming model --><annotation-driven /><!--scan the package containing @Controller annotated class to create a controller bean --><context:component-scan base-package="your.package.name" />
0 0
- Spring MVC framework[2] Controller
- Zend Framework教程-MVC-Controller
- spring MVC -controller
- spring mvc的Controller
- Spring MVC Controller
- Spring MVC中的Controller
- spring mvc controller
- spring MVC controller 跳转
- Spring MVC-Controller
- spring mvc controller
- Spring MVC 中的 Controller
- Spring MVC HelloWorld-Controller
- Spring mvc 的controller
- Spring MVC Controller 单元测试
- Spring MVC 中的 Controller
- 【Java.Spring.MVC】Controller
- spring mvc找不到controller
- spring mvc controller 传参
- 安卓事件传递机制探究
- C++ RTTI特性:typeid/dynamic_cast及常用四种类型转换运算符
- 数组Array的排序sort
- 性能优化之布局优化
- 华为机试电话号码翻译C++实现
- Spring MVC framework[2] Controller
- 基类和派生类非虚函数和成员变量的同名
- MySQL InnoDB 共享表空间和独立表空间
- HDU-1002
- c++ 数据类型,及其使用技巧
- HDU2767.Proving Equivalences等价性证明——SCC
- OC内存管理学习感悟
- 蓝桥杯第四届C本科B类
- IOS调试技巧:当程序崩溃的时候怎么办 iphone IOS