zoukankan      html  css  js  c++  java
  • springMvc中restful风格的api路径中把小数点当参数,SpringMvc中url有小数点

    在springMvc web项目中restful风格的api路径中有小数点会被过滤后台拿不到最后一个小数点的问题,

    有两种解决方案:

    1:在api路径中加入:.+

    1. @RequestMapping("/findByIp/{ip:.+}")
    2. public Object test(@PathVariable String ip) {
    3. System.out.println(ip);
    4. return "";
    5. }

    但这种方式在web服务中感觉太过于鸡肋

    所以在springMvc.xml中配置mvc标签

    2.<mvc:path-matching registered-suffixes-only="true"/>

    1. <mvc:annotation-driven >
    2. <mvc:path-matching registered-suffixes-only="true"/>
    3. </mvc:annotation-driven>
  • 相关阅读:
    hdu1089
    hdu1088
    驴妈妈
    途牛悄然上市 登陆SEC途牛前景如何
    途牛旅游网
    百度-----携程
    携程旅行网
    手机游戏
    web
    改造 改革
  • 原文地址:https://www.cnblogs.com/jpfss/p/9934203.html
Copyright © 2011-2022 走看看