spring mvc中的@PathVariable
spring mvc中的@PathVariable是用来获得请求url中的动态参数的,十分方便,复习下:
- @Controller
- public class TestController {
- @RequestMapping(value="/user/{userId}/roles/{roleId}",method = RequestMethod.GET)
- public String getLogin(@PathVariable("userId") String userId,
- @PathVariable("roleId") String roleId){
- System.out.println("User Id : " + userId);
- System.out.println("Role Id : " + roleId);
- return "hello";
- }
- @RequestMapping(value="/product/{productId}",method = RequestMethod.GET)
- public String getProduct(@PathVariable("productId") String productId){
- System.out.println("Product Id : " + productId);
- return "hello";
- }
- @RequestMapping(value="/javabeat/{regexp1:[a-z-]+}",
- method = RequestMethod.GET)
- public String getRegExp(@PathVariable("regexp1") String regexp1){
- System.out.println("URI Part 1 : " + regexp1);
- return "hello";
- }
- }
spring mvc中的@PathVariable的更多相关文章
- spring mvc中的@PathVariable(转)
鸣谢:http://jackyrong.iteye.com/blog/2059307 ------------------------------------------------ spring m ...
- Spring mvc中@RequestMapping 6个基本用法
Spring mvc中@RequestMapping 6个基本用法 spring mvc中的@RequestMapping的用法. 1)最基本的,方法级别上应用,例如: Java代码 @Reques ...
- Http请求中Content-Type讲解以及在Spring MVC中的应用
引言: 在Http请求中,我们每天都在使用Content-type来指定不同格式的请求信息,但是却很少有人去全面了解content-type中允许的值有多少,这里将讲解Content-Type的可用值 ...
- Spring mvc中@RequestMapping 6个基本用法小结(转载)
小结下spring mvc中的@RequestMapping的用法. 1)最基本的,方法级别上应用,例如: @RequestMapping(value="/departments" ...
- Spring MVC 中的基于注解的 Controller【转】
原文地址:http://my.oschina.net/abian/blog/128028 终于来到了基于注解的 Spring MVC 了.之前我们所讲到的 handler,需要根据 url 并通过 H ...
- Spring MVC中基于注解的 Controller
终于来到了基于注解的 Spring MVC 了.之前我们所讲到的 handler,需要根据 url 并通过 HandlerMapping 来映射出相应的 handler 并调用相应的方法以响 ...
- Spring MVC中的HandlerMapping与HandlerAdapter
*:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: 0 !important; } /* ...
- Http请求中Content-Type讲解以及在Spring MVC中的应用【转】
完全引用自: http://blog.csdn.net/blueheart20/article/details/45174399#t1 此文讲得很清晰,赞! 引言: 在Http请求中,我们每天都在 ...
- Spring MVC 中 @ModelAttribute 注解的妙用
Spring MVC 中 @ModelAttribute 注解的妙用 Spring MVC 提供的这种基于注释的编程模型,极大的简化了 web 应用的开发.其中 @Controller 和 @Rest ...
随机推荐
- 10 种机器学习算法的要点(附 Python)(转载)
一.前言 谷歌董事长施密特曾说过:虽然谷歌的无人驾驶汽车和机器人受到了许多媒体关注,但是这家公司真正的未来在于机器学习,一种让计算机更聪明.更个性化的技术 也许我们生活在人类历史上最关键的时期:从使用 ...
- Java之基本类库学习
JAVA基本类库: (一),输入相关 main(String[] args):设置输入参数 输入类:Scanner:Scanner sc=new Scanner(System.in); (二),系统相 ...
- fabricjs 高级篇(自定义类型)
原文:https://www.sitepoint.com/fabric-js-advanced/ <html> <head> <script src='./js/fabr ...
- 配置 FIS 来适配 go revel 框架以优化前端缓存策略
对于前端工程师来说,浏览器缓存优化是个永远的话题.前几天看了知乎上的一个问答:<大公司里怎样开发和部署前端代码?>,深以为然,所以决心使用 FIS 来优化自身的前端文件. 我们的项目使用了 ...
- Codeforces #282 div 1 C Helping People 题解
CF 282 C Helping People 题解 [原题] time limit per test 2 seconds memory limit per test 512 megabytes in ...
- PL-SQL 包的创建和应用
PL-SQL 包的创建和应用 ①简单介绍 包是一组相关过程.函数.变量.常量和游标等PL/SQL程序设计元素的组合,它具有面向对象程序设计语言的特点.是对这些PL/SQL 程序设计元素的 ...
- iOS实录:GCD使用小结(一)
导语:在iOS中,多线程方案有四种:pthread.NSThread.NSOperation & NSOperationQueue 和 GCD,但是开发中GCD使用得最多,本文主要总结一下我使 ...
- 性能测试之Tomcat优化
1.Tomcat最大连接数等配置 Tomcat的server.xml中Context元素的以下参数都是什么意思? <Connector port="8080"maxThr ...
- Android学习(二十三)SubMenu 子菜单
一.SubMenu子菜单 和功能菜单相似,但是可以添加子菜单. 二.实现步骤: 1.通过onCreateOptionsMenu方法创建子菜单,可以通过代码动态创建,也可以通过xml进行创建. 2.通过 ...
- [转载]Error -27796: Failed to connect to server
原文地址:Error -27796: Failed to connect to server "test.shunde.gov.cn:80"作者:蓝小C 问题描述: 使用Loa ...