zoukankan      html  css  js  c++  java
  • @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";  

         }  

    }  

    http://jackyrong.iteye.com/blog/2059307 感谢分享,学习了!~

  • 相关阅读:
    查看pip install *.whl 支持的文件版本
    spark Infinate 的处理
    nc 文件的nan识别
    mysql 存中文失败问题
    tensorflow 安装
    数据库存含中文的json 时避免存成中文的ascii
    python 继承中的__init__
    python mysql数据库中 json的存储
    python 版本配置问题
    python dict 实现swich
  • 原文地址:https://www.cnblogs.com/wdnnccey/p/6017624.html
Copyright © 2011-2022 走看看