spring mvc 5.0 @PathVariable 详解 04
来源:互联网 发布:屏幕去蓝光软件 编辑:程序博客网 时间:2024/06/05 05:07
带占位符的 URL 是 Spring3.0 新增的功能,该功能在SpringMVC 向 REST 目标挺进发展过程中具有里程碑的意义
通过 @PathVariable 可以将 URL 中占位符参数绑定到控制器处理方法的入参中:URL 中的 {xxx} 占位符可以通过@PathVariable("xxx") 绑定到操作方法的入参中。
index.jsp
<html><body><h2>Hello World!</h2><a href="hello/abc">hello abc</a><br><br></body></html>
Controller
package com.ruge.mvc;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.PathVariable;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestMethod;/** * @author 爱丽丝、如歌 * @Description: TODO * @date 2017/12/19 13:44 */@Controllerpublic class demo01 { @RequestMapping(value = "/hello/{name}" , method = RequestMethod.GET) public String hello(@PathVariable(value = "name") String name){ System.out.println("hello"+name); return "hello"; }}
阅读全文
0 0
- spring mvc 5.0 @PathVariable 详解 04
- spring mvc中的@PathVariable
- spring mvc中的@PathVariable
- spring mvc中的@PathVariable
- spring mvc中的@PathVariable
- spring mvc中的@PathVariable
- spring mvc中的@PathVariable
- Spring MVC 05 - @PathVariable
- Spring MVC PathVariable
- spring mvc中的@PathVariable
- Spring MVC @PathVariable注解
- Spring MVC中的@PathVariable
- Spring MVC PathVariable注解
- spring MVC @RequestParam @RequestBody @PathVariable 等参数绑定注解详解
- Spring MVC之@RequestBody, @ResponseBody @PathVariable @SessionAttributes @ModelAttribute详解
- Spring MVC中常用注解之@ResponseBody,@RequestBody,@PathVariable详解
- spring mvc @PathVariable和@RequestParam
- Spring MVC @RequestParam与@PathVariable
- 《A Large Dataset to Train Convolutional Networks for Disparity, Optical Flow, and Scene Flow Estimat
- Caffe 源码
- freemarker javascript 后台传值
- 区块链最基本的技术原理
- 杭电acm 2544 最短路
- spring mvc 5.0 @PathVariable 详解 04
- 初学Servlet3.0新特性
- 小朋友学Java(1):Mac系统安装JDK
- thinkphp清除BOM方法
- 小朋友学Java(2):Win 7安装JDK
- webpack在开发中的应用
- Go 学习笔记:Println 与 Printf 的区别,以及 Printf 的详细用法
- CentOS7.4安装Mysql
- 设计模式-策略模式