鸣谢:http://jackyrong.iteye.com/blog/2059307

------------------------------------------------

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(转)的更多相关文章

  1. spring mvc中的@PathVariable

    spring mvc中的@PathVariable是用来获得请求url中的动态参数的,十分方便,复习下: @Controller public class TestController { @Requ ...

  2. Spring mvc中@RequestMapping 6个基本用法

    Spring mvc中@RequestMapping 6个基本用法 spring mvc中的@RequestMapping的用法.  1)最基本的,方法级别上应用,例如: Java代码 @Reques ...

  3. Http请求中Content-Type讲解以及在Spring MVC中的应用

    引言: 在Http请求中,我们每天都在使用Content-type来指定不同格式的请求信息,但是却很少有人去全面了解content-type中允许的值有多少,这里将讲解Content-Type的可用值 ...

  4. Spring mvc中@RequestMapping 6个基本用法小结(转载)

    小结下spring mvc中的@RequestMapping的用法. 1)最基本的,方法级别上应用,例如: @RequestMapping(value="/departments" ...

  5. Spring MVC 中的基于注解的 Controller【转】

    原文地址:http://my.oschina.net/abian/blog/128028 终于来到了基于注解的 Spring MVC 了.之前我们所讲到的 handler,需要根据 url 并通过 H ...

  6. Spring MVC中基于注解的 Controller

         终于来到了基于注解的 Spring MVC 了.之前我们所讲到的 handler,需要根据 url 并通过 HandlerMapping 来映射出相应的 handler 并调用相应的方法以响 ...

  7. Spring MVC中的HandlerMapping与HandlerAdapter

    *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: 0 !important; } /* ...

  8. Http请求中Content-Type讲解以及在Spring MVC中的应用【转】

    完全引用自: http://blog.csdn.net/blueheart20/article/details/45174399#t1   此文讲得很清晰,赞! 引言: 在Http请求中,我们每天都在 ...

  9. Spring MVC 中 @ModelAttribute 注解的妙用

    Spring MVC 中 @ModelAttribute 注解的妙用 Spring MVC 提供的这种基于注释的编程模型,极大的简化了 web 应用的开发.其中 @Controller 和 @Rest ...

随机推荐

  1. 纯css 写三角形

    <div style="width: 0;height: 0;border-left: 6px solid transparent;border-right: 6px solid tr ...

  2. CXF(2.7.10) - WSDL2Java generated Client

    以调用 http://www.webxml.com.cn/ 提供的 IpAddressSearchWebService 服务为例. 1. 使用 wsdl2java 工具,根据 wsdl 生成 JAX- ...

  3. Jersey(1.19.1) - Hello World, Get started with a Web application

    1. Maven Dependency <properties> <jersey.version>1.19.1</jersey.version> </prop ...

  4. 配置对IIS上tabular的 HTTP 访问

    上周网管说某部门一同事用的自家电脑办公,操作系统是正版win8家庭版,不能加入公司域,求解如何访问数据仓库. 以前一直以为只有域内用户才能使用数据仓库,没办法有问题总要给人解决,一味地推脱不但会影响其 ...

  5. Debian8 加载NTFS 磁盘出错 解决方法

    执行 ntfsfix  /dev/sdb2 // sd*  a代表第一块硬盘 b代表第2块硬盘 数字是分区号 执行后 就可以正常使用了.

  6. 【原创】birt 报表工具 不能运行 不能预览问题

    在windows 7以上版本中可能会遇到不能预览,或者不能再web查看器中查看 ,但是可以以html的方式查看.在网上看了好多解决方法,我试了都不可行,说明我遇到的问题不和他们的一样,这样怎么办呢? ...

  7. 第五篇、iOS常用的工具 app icon 、office文件格式互转、在线HTML编辑器、16、10进制互转

    1.图片工厂,一键生成所以的应用图标 2.office文件转换格式 3.HTML在线编辑器 4.十六进制和十进制互转

  8. C++编译期判断是否能够转型

    #include <iostream> #include <vector> using namespace std; template<class T,class U&g ...

  9. JBoss部署项目log4j配置会造成死锁问题,浏览器访问一直pending状态

    今天将项目部署到JBoss服务器上,部署成功后,浏览器访问页面一直在等待响应. 查了很长时间,最后在服务器上通过jstack pid命令查看Java堆栈信息,发现了有两个线程死锁. 看到造成死锁的原因 ...

  10. SAP第一轮面试之英语群面

    很高兴通过了SAP的笔试,昨天进行了一轮面试.SAP一轮面试是英语群面(无领导小组讨论) 面试提前大约五天的样子通知面试时间地点,一般是在公司,要求正装.这些都会在HR联系你时通知的,所以不再啰嗦. ...