package zpark.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import zpark.entity.User; /**
* @controller 单例
* @Scope("prototype") 多例
*/
@Controller
@RequestMapping("/restFul")
public class RestFulController { /**
* 多个参数:
* @PathVariable 获取{}中的值
* 若方法参数名称和{}中变量名称不一致,需要在@PathVariable("name")指定名称。
*
* @param id
* @param name
* http://localhost:9999/restFul/find/123/aa
*/ @RequestMapping(value="/find/{myId}/{name}",method=RequestMethod.GET)
public String test(@PathVariable(value="myId") Integer id,@PathVariable String name){
System.out.println(id);
System.out.println(name);
return "index";
} /**
* 一个参数
* @param id
* @param name
* http://localhost:9999/restFul/json/123
*/
@RequestMapping(value="/json/{id}")
public String test1(@PathVariable Integer id, String name){
System.out.println(id);
System.out.println(name);
return "index";
} }

springMvc发布restFull风格的URL的更多相关文章

  1. springMVC的rest风格的url请求

    rest是一个架构风格,用url来访问网络上的任何资源.rest的一种思想就是用http中的动作get,post,put,delete,来进行增删改查. 这里介绍的是springMVC的rest请求. ...

  2. cxf和spring结合,发布restFull风格的服务

    rest(Representational State Transfer):表现层状态转化,它是一种风格,用于资源定位,例如:http://ip:port/user/student/001 和资源操作 ...

  3. SpringMVC实现AJax以及RestFull风格

    RestFull风格就是url路径中不能出现?不能带参数,如https://www.baidu.com/user/item/1234这个格式,也叫url资源定位 1.需要在web.xml中开启put, ...

  4. 如何在SpringMVC中使用REST风格的url

    如何在SpringMVC中使用REST风格的url 1.url写法: get:/restUrl/{id} post:/restUrl delete:/restUrl/{id} put:/restUrl ...

  5. springmvc REST风格的URL

    1:需要配置一个filter <!-- 配置 org.springframework.web.filter.HiddenHttpMethodFilter: 可以把 POST 请求转为 DELET ...

  6. Spring整合CXF,发布RSETful 风格WebService(转)

    Spring整合CXF,发布RSETful 风格WebService 这篇文章是承接之前CXF整合Spring的这个项目示例的延伸,所以有很大一部分都是一样的.关于发布CXF WebServer和Sp ...

  7. Spring MVC 使用HiddenHttpMethodFilter配置Rest风格的URL

    /** Rest 风格的 URL. 以 CRUD 为例: 新增: /order POST 修改: /order/1 PUT update?id=1 获取:/order/1 GET get?id=1 删 ...

  8. [五]SpringMvc学习-Restful风格实现

    1.Restful风格的资源URL 无后缀资源的访问(csdn用法) 2.SpringMvc对Rest风格的支持 2.1将 /*.do改为/ 2.2 3.@PathVariable获取Url变量 @R ...

  9. Spring MVC 使用拦截器 HiddenHttpMethodFilter配置Rest风格的URL

    <!-- 4.使用Rest风格的URI,将页面普通的post请求转为指定的delete或者put请求 --> 详细使用请参考这篇博客:地址:http://blog.csdn.net/ppl ...

随机推荐

  1. Arch Linux sudo: PAM authentication error: Module is unknown [Solved!]

    问题描述: 我的 Arch Linux 已经用了快半年多,由于 Arch Linux 的滚挂问题,我从没有直接升级过系统.软件版本以及库自然落后了一些. 就在我准备需要用到 NFS 时,挂载网络文件系 ...

  2. IO - 同步,异步,阻塞,非阻塞 (亡羊补牢篇)

    IO - 同步,异步,阻塞,非阻塞 (亡羊补牢篇) 当你发现自己最受欢迎的一篇blog其实大错特错时,这绝对不是一件让人愉悦的事. <IO - 同步,异步,阻塞,非阻塞 >是我在开始学习e ...

  3. git 学习使用总结一(本地操作)

    通过几天的学习,熟悉了 git 的一些常用命令,要用熟练和操作更复杂的功能还必须继续学习.不过 git 作为工具,它是用来提高我们的工作效率的工具,系统的学习之后可以暂且放放,等到以后实际项目中用到了 ...

  4. Stanford机器学习笔记-2.Logistic Regression

    Content: 2 Logistic Regression. 2.1 Classification. 2.2 Hypothesis representation. 2.2.1 Interpretin ...

  5. Ubuntu下初学ROS时所遇小问题

    [1]运行命令$ rospack depends1 beginner_tutorials 时,提示 : [rospack] Error: no such package beginner_tutori ...

  6. [No000030]程序员节发点别的:中国教育整个把人脑子搞坏了-易中天

    导读 在易中天看来,中国教育和中国文化的问题一样,是弱智化.搞坏的原因是什么?是我们的教育评价目标就是"成王败寇"四个字.他明确提出反对励志,反对培优,反对成功学,反对望子成龙.他 ...

  7. [No000000]常用软件测试编译环境声明

    程序语言这东西并不重要,重要的是你用这些语言做的事情. 操作系统:WIN8.1 X64 运行库&支持库: DirectX,Microsoft Visual C++ (VC运行库包括X86版)2 ...

  8. win10的安装与下载

    1.下载介质创建工具 https://www.microsoft.com/zh-cn/software-download/windows10 2. 下载iso https://www.microsof ...

  9. NOIP2015提高组Day1 Message

    题目描述 有n个同学(编号为1到n)正在玩一个信息传递的游戏.在游戏里每人都有一个固定的信息传递对象,其中,编号为i的同学的信息传递对象是编号为Ti同学. 游戏开始时,每人都只知道自己的生日.之后每一 ...

  10. 画图解释 SQL join 语句

    转:http://blog.jobbole.com/40443/ 本文由 伯乐在线 - 奇风余谷 翻译.未经许可,禁止转载!英文出处:Jeff Atwood.欢迎加入翻译组. 我认为 Ligaya T ...