spring: @RequestMapping注解
处理GET/POST请求方法
1.常用的:
import org.springframework.web.bind.annotation.RequestMapping; @Controller
public class HomeController { //处理"/"的GET请求方法1
@RequestMapping(value="/",method=GET)
public String home()
{
return "home";
}
}
2常用方法
import org.springframework.web.bind.annotation.RequestMapping; @Controller
//处理"/"的GET请求方法2
@RequestMapping("/")
public class HomeController { //处理"/"的GET请求方法2
@RequestMapping(method=GET)
public String home()
{
return "home";
}
}
3.常用方法,数组
import org.springframework.web.bind.annotation.RequestMapping; @Controller
@RequestMapping({"/","/homepage"})
public class HomeController { public String home()
{
return "home";
}
}
spring: @RequestMapping注解的更多相关文章
- 超详细 Spring @RequestMapping 注解使用技巧
@RequestMapping 是 Spring Web 应用程序中最常被用到的注解之一.这个注解会将 HTTP 请求映射到 MVC 和 REST 控制器的处理方法上. 在这篇文章中,你将会看到 @R ...
- Spring @RequestMapping 注解使用技巧
@RequestMapping 是 Spring Web 应用程序中最常被用到的注解之一.这个注解会将 HTTP 请求映射到 MVC 和 REST 控制器的处理方法上. 在这篇文章中,你将会看到 @R ...
- 超详细 Spring @RequestMapping 注解使用技巧 (转)
@RequestMapping 是 Spring Web 应用程序中最常被用到的注解之一.这个注解会将 HTTP 请求映射到 MVC 和 REST 控制器的处理方法上. 在这篇文章中,你将会看到 @R ...
- spring @RequestMapping注解技巧
@RequestMapping 是 Spring Web 应用程序中最常被用到的注解之一.这个注解会将 HTTP 请求映射到 MVC 和 REST 控制器的处理方法上. 下面我们看看,@Request ...
- Spring MVC @RequestMapping注解详解
@RequestMapping 参数说明 value:定义处理方法的请求的 URL 地址.(重点) method:定义处理方法的 http method 类型,如 GET.POST 等.(重点) pa ...
- spring mvc 注解@Controller @RequestMapping @Resource的详细例子
现在主流的Web MVC框架除了Struts这个主力 外,其次就是Spring MVC了,因此这也是作为一名程序员需要掌握的主流框架,框架选择多了,应对多变的需求和业务时,可实行的方案自然就多了.不过 ...
- 0054 Spring MVC的@Controller和@RequestMapping注解
@Controller注解 该注解用来指示一个类是一个控制器,在Spring的配置xml文件中开启注解扫描 <context:conponent-scan base-package=" ...
- Spring MVC中@RequestMapping注解使用技巧(转)
@RequestMapping是Spring Web应用程序中最常被用到的注解之一.这个注解会将HTTP请求映射到MVC和REST控制器的处理方法上. 在这篇文章中,你将会看到@RequestMapp ...
- Spring MVC @RequestMapping注解详解(2)
@RequestMapping 参数说明 value:定义处理方法的请求的 URL 地址.(重点) method:定义处理方法的 http method 类型,如 GET.POST 等.(重点) pa ...
随机推荐
- sublime使用及插件
转自 http://www.cnblogs.com/Rising/p/3741116.html
- "AppServer"--->UDP--->"LogWriteServer"
w 是否应该将日志的“写”独立至局域网的一台或一群专门服务于“写日志”的服务器?这样让“app服务器”专职地处理用户的请求,而不必因为“写日志甚至异步分析日志”来降低用户体验? Spencer老师 其 ...
- Java算法之“兔子问题”
package wulj; /** * Java算法之“兔子问题”: * 有一只兔子,从出生后第3个月起每个月都生只兔子,小兔子长到第三个月后每个月又生一只兔子,假如兔子都不死,问每个月的兔子总数为多 ...
- 在容器最前面添加DOM元素 parent.insertBefore(new, parent.children[0])
//判断容器当前有没有子级元素,如果没有直接appendChild就行了; if (p.children[0]) { p.insertBefore(span, p.children[0]); } el ...
- django之多表查询-2
2018-11-14 一 \\ 基于双下划线的跨表查询: 套路一样,用__跨表 -一对多 -多对多 from app.models import * 查询出版社为北京出版社出版的所有图书的名字,价格 ...
- 学习笔记のsendRedirect &forward
尽管HttpServletResponse.sendRedirect方法和RequestDispatcher.forward方法都可以让浏览器获得另外一个URL所指向的资源,但两者的内部运行机制有着很 ...
- Ionic 3 项目的工程目录结构(转载)
工程目录结构说明如下图
- 创建pfx数字证书
相关参考: 安全工具: http://msdn.microsoft.com/zh-cn/library/dd233106(v=vs.110).aspx makecert: http://msdn.mi ...
- Python函数之初体验
定义函数 在Python中,定义一个函数要使用def语句,依次写出函数名.括号.括号中的参数和冒号:,然后,在缩进块中编写函数体,函数的返回值用return语句返回. 我们先定义一个求字符串长度的函数 ...
- IO 复习笔记
输入流,从源到流中:输出流,从流到目的地. 1. 操作文件: 1).写入:FileOutputStream或者FileWriter 2).读取:FileInputStream或者Fil ...