springMvc发布restFull风格的URL
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的更多相关文章
- springMVC的rest风格的url请求
rest是一个架构风格,用url来访问网络上的任何资源.rest的一种思想就是用http中的动作get,post,put,delete,来进行增删改查. 这里介绍的是springMVC的rest请求. ...
- cxf和spring结合,发布restFull风格的服务
rest(Representational State Transfer):表现层状态转化,它是一种风格,用于资源定位,例如:http://ip:port/user/student/001 和资源操作 ...
- SpringMVC实现AJax以及RestFull风格
RestFull风格就是url路径中不能出现?不能带参数,如https://www.baidu.com/user/item/1234这个格式,也叫url资源定位 1.需要在web.xml中开启put, ...
- 如何在SpringMVC中使用REST风格的url
如何在SpringMVC中使用REST风格的url 1.url写法: get:/restUrl/{id} post:/restUrl delete:/restUrl/{id} put:/restUrl ...
- springmvc REST风格的URL
1:需要配置一个filter <!-- 配置 org.springframework.web.filter.HiddenHttpMethodFilter: 可以把 POST 请求转为 DELET ...
- Spring整合CXF,发布RSETful 风格WebService(转)
Spring整合CXF,发布RSETful 风格WebService 这篇文章是承接之前CXF整合Spring的这个项目示例的延伸,所以有很大一部分都是一样的.关于发布CXF WebServer和Sp ...
- Spring MVC 使用HiddenHttpMethodFilter配置Rest风格的URL
/** Rest 风格的 URL. 以 CRUD 为例: 新增: /order POST 修改: /order/1 PUT update?id=1 获取:/order/1 GET get?id=1 删 ...
- [五]SpringMvc学习-Restful风格实现
1.Restful风格的资源URL 无后缀资源的访问(csdn用法) 2.SpringMvc对Rest风格的支持 2.1将 /*.do改为/ 2.2 3.@PathVariable获取Url变量 @R ...
- Spring MVC 使用拦截器 HiddenHttpMethodFilter配置Rest风格的URL
<!-- 4.使用Rest风格的URI,将页面普通的post请求转为指定的delete或者put请求 --> 详细使用请参考这篇博客:地址:http://blog.csdn.net/ppl ...
随机推荐
- 深入理解TCP(二)
上一篇http://www.cnblogs.com/whc-uestc/p/4715334.html中已经讲到TCP跟踪一个拥塞窗口来(cwnd)提供拥塞控制服务,通过调节cwnd值以控制发送速率.那 ...
- CentOS最大文件描述符限制更改
系统级的限制:/proc/sys/fs/file-max中设定了系统最大能打开的文件数. 查看该值可以用如下方式: [root@#panda ~]# cat /proc/sys/fs/file-max ...
- linux监控命令nc用法
一.nc命令检测端口的用法 # nc -v -w 10 %IP% -z %PORT% -v 显示指令执行过程. -w <超时秒数> 设置等待连线的时间. -u 表示使用UDP协议 -z 使 ...
- 查看linux系统,服务,配置文件被修改的时间
如何查看服务启动时间 [root@qike /]# ps -ef |grep nginx root 14730 1 0 16:45 ? 00:00:00 nginx: master process / ...
- [转]KendoUI系列:Grid
本文转自:http://www.cnblogs.com/libingql/p/3774879.html 1.基本使用 <div id="grid"></div&g ...
- Virtual Box常用指令
以下操作需在命令行里将当前路径设为 Virtual Box安装目录 1. 调整磁盘大小(只能调整动态分配的.vdi格式文件) VBoxManage modifyhd "xxx.vdi&quo ...
- Pairs Forming LCM(素因子分解)
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=109329#problem/B 全题在文末. 题意:在a,b中(a,b<=n) ...
- 以最简单的登录为例,诠释JS面向对象的简单实例
JavaScript,是前端开发人员必须会的一门技术,从JS演变出来的有很多框架,先说说几个热门的框架吧: JQuery:这个技术必须会,如果不会,那一定要会查api,知道怎么写,要看得懂英文文档,这 ...
- POJ1129Channel Allocation[迭代加深搜索 四色定理]
Channel Allocation Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 14601 Accepted: 74 ...
- AC日记——字符串最大跨距 openjudge 1.7 26
26:字符串最大跨距 总时间限制: 1000ms 内存限制: 65536kB 描述 有三个字符串S,S1,S2,其中,S长度不超过300,S1和S2的长度不超过10.想检测S1和S2是否同时在S中 ...