spring mvc中的@PathVariable(转)
鸣谢: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(转)的更多相关文章
- spring mvc中的@PathVariable
spring mvc中的@PathVariable是用来获得请求url中的动态参数的,十分方便,复习下: @Controller public class TestController { @Requ ...
- 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 ...
随机推荐
- MySqlDataReader在Using中使用
结论:当DataReader放在Using方法中时,会自动释放资源,如果中途出现了异常处理,也同样会释放掉占用的资源.测试过程:这里由于没有将全部分过程记录下来,只是对结果大体的说明一下,有兴趣的童鞋 ...
- ActiveMQ(5.10.0) - Configuring the JAAS Authentication Plug-in
JAAS provides pluggable authentication, which means ActiveMQ will use the same authentication API re ...
- Git CMD - reset: Reset current HEAD to the specified state
命令格式 git reset [-q] [<tree-ish>] [--] <paths>… git reset (--patch | -p) [<tree-ish&g ...
- SSRS:之为用户“NT AUTHORITY\NETWORK SERVICE”授予的权限不足,无法执行此操作。 (rsAccessDenied)
错误信息: 为用户"NT AUTHORITY\NETWORK SERVICE"授予的权限不足,无法执行此操作. (rsAccessDenied) 如图: 解决方案之检查顺序: 1. ...
- Span flag详解
在android中,如果要实现text的各种样式,图文混排等,简单的样式可以靠几个不同的textview来拼成,而复杂的样式要求,用不同的textview来拼接则不太现 实.这时候就spannable ...
- JavaBean在JSP中显示时间
创建DateTimeBean的类,将其放置于org.caiduping.bean的包中,实现时间,星期的封装. package org.caiduping.bean; import java.text ...
- MVC5----用户登陆及验证码
随便写写记录一下学习的过程 登陆 Models中添加添加 public class LoginViewModel { [Required(ErrorMessage = "*")] ...
- using System.Collections.Generic;
public class CommonClass { public static void ShowInt(int iValue) { //typeof(CommonClass) typeof关键字 ...
- 方法:查询MongoDB数据库中最新一条数据(JAVA)
使用JAVA语言查询MongoDB中某个数据库某个集合的最新一条数据: MongoCollection<Document> cpu = MongoClient.getDatabase(&q ...
- windows系统下在dos命令行kill掉被占用的pid
备忘 1.开始-->运行-->cmd 2.命令行输入: netstat -ano I findstr 端口(被占用的端口号) 3.输入: tasklist | findstr 端口(获取步 ...