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 ...
随机推荐
- C# RGB和HSB相互转换
背景 最近做的项目中有这样一个场景,设置任意一种颜色,得到这种颜色偏深和偏浅的两种颜色.也就是说取该颜色同色系的深浅两种颜色.首先想到的是调节透明度,但效果不理想.后来尝试调节颜色亮度,发现这才是正解 ...
- [转]C#网络编程(异步传输字符串) - Part.3
本文转自:http://www.tracefact.net/CSharp-Programming/Network-Programming-Part3.aspx 这篇文章我们将前进一大步,使用异步的方式 ...
- POJ1837 Balance[分组背包]
Balance Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 13717 Accepted: 8616 Descript ...
- ural Infernal Work
Infernal Work Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Descr ...
- ComboBox的数据联动
实现效果: 点击年级下拉框值时,获取科目下拉框值 一:加载年级下拉框值 GradeDAL层: //检索所有年级名称集合,返回的是泛型集合List<Grade> public List< ...
- codevs 1002 搭桥
codevs 第一道题 先贴描述 1002 搭桥 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 题解 查看运行结果 题目描述 Description ...
- Hibernate一对一关系映射
Hibernate提供了两种一对一映射关联关系的方式: 1)按照外键映射 2)按照主键映射 下面以员工账号表和员工档案表(员工账号和档案表之间是一对一的关系)为例,介绍这两种映射关系,并使用这两种 映 ...
- 比较全的JavaScript倒计时脚本[xyytit]
需要做一个功能,给特定的活动或者商品添加一个倒计时提示,在网上找了好些方法,总结了比较好的一些方法,以备后用: 1. 比较长时间的倒计时(如:距离2014年还有0年, 0月, 30天, 9小时, 41 ...
- rownum和sum一起使用经验
因为sum的使用需要group by的,所以,对于sum出来的东西想要排序,使用rownum的话,不能直接放在SQL里面的. 可以这样. select rownum,R.* ( select sum( ...
- 装完Centos7提示Initial setup of CentOS Linux 7 (core)(转载)
http://www.th7.cn/system/lin/201603/156762.shtml