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 ...
随机推荐
- case...when...简单用法sql说明
1.项目用到的sql展示 select n.name,n.position, case when ( then '有' else '无' end PUNISHMENT, case when ( the ...
- Apache Beam WordCount编程实战及源代码解读
概述:Apache Beam WordCount编程实战及源代码解读,并通过intellij IDEA和terminal两种方式调试执行WordCount程序,Apache Beam对大数据的批处理和 ...
- 【Hadoop】Hadoop MR 自定义序列化类
1.基本概念 2.Mapper代码 package com.ares.hadoop.mr.flowsum; import java.io.IOException; import org.apache. ...
- div 事件透传
有些时候,我们会想要把一个 div 层覆盖在另一个 div 层上,要让下层的 div 响应鼠标事件而上层的不响应仅仅只做内容展示. 这种时候,我们就可以用到一个 CSS 属性:pointer-even ...
- DB门面,查询构建器,Eloquent ORM三者的CURD
一.DB门面 1.insert DB::insert('insert into table(`name`) value(?)', ['test']); 2.update DB::update('upd ...
- 模式识别:利用MATLAB生成模式类
近期開始了模式识别的学习,在此之前须要对模式和模式类的概念有一个了解,这里使用MATLAB实现一些模式类的生成.在此之前,引用百科上对于模式识别和模式类的定义.也算加深以下了解: 模式识别(Patte ...
- UE4射击小游戏原型
尝试使用了下blueprint,不知道是bug还是不熟悉,blueprint有些地方运行的跟逻辑不太一样.不管ue4目前,快速做原型倒是蛮方便的.就等着官方发更多教程讲述关于新的matinee,Nav ...
- mongo: 索引
索引创建 在学习索引之前,我们先看一下,如果没有添加索引时,我们用explain()函数,查看查询计划是什么样的. 发现使用的是BasicCursor,那么就代表我们没有索引,当我们查某一个数据的时候 ...
- 苹果版小黄车(ofo)app主页菜单效果
代码地址如下:http://www.demodashi.com/demo/12823.html 前言: 最近又是公司项目上线一段时间了,又是到了程序汪整理代码的节奏了.刚好也用到了ofo主页菜单的效果 ...
- jenkins构建java项目找不到命令mvn,java的解决方法
jenkins构建java项目时出现的报错情况: $ mvn clean install FATAL: command execution failed java.io.IOException: er ...