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 ...
随机推荐
- elasticsearch 集群搭建
需要编辑的文件是config/elasticsearch.yml文件 需要配置的项目有: # Use a descriptive name for your cluster: # cluster.na ...
- 解决PowerShell命令行窗口中不显示光标的问题
不知道什么原因,在有些系统上打开PowerShell命令行窗口后,光标无法显示.这种情况在Windows Server 2008/2012.Windows 8/9/10上都出现过,估计是由于某些系统软 ...
- [转]12篇学通C#网络编程——第二篇 HTTP应用编程(上)
本文转自:http://www.cnblogs.com/huangxincheng/archive/2012/01/09/2316745.html 我们学习网络编程最熟悉的莫过于Http,好,我们就从 ...
- Use getopt() & getopt_long() to Parse Arguments
Today I came across a function [getopt] by accident. It is very useful to parse command-line argumen ...
- Deploying an Internet Information Services-Hosted WCF Service
Deploying an Internet Information Services-Hosted WCF Service .NET Framework 4 Other Versions .NET ...
- [No000002]大学本科文凭贬值了多少?
<大学本科文凭贬值了多少?> 朋友开网络公司,招应届毕业生.他们是小本经营,人手本就不多,面试的时候,忙不过来就会拉我过去,假装是公司的面试官.主管什么的,算是滥竽充数.我装模作样面试了几 ...
- Web.config配置文件详解(新手必看)(转)
转于:http://www.cnblogs.com/gaoweipeng/archive/2009/05/17/1458762.html <?xml version="1.0" ...
- java多线程系类:基础篇:02常用的实现多线程的两种方式
本章,我们学习"常用的实现多线程的2种方式":Thread 和 Runnable.之所以说是常用的,是因为通过还可以通过java.util.concurrent包中的线程池来实现多 ...
- SQL Server 查询性能优化 相关文章
来自: SQL Server 查询性能优化——堆表.碎片与索引(一) SQL Server 查询性能优化——堆表.碎片与索引(二) SQL Server 查询性能优化——覆盖索引(一) SQL Ser ...
- 折腾了1周把程序从sqlserver迁移到oracle上了,每折腾一次需要耗费1周时间
主要花费时间的事情: 1:安装配套的服务器,安装操作系统,安装数据库,配置远程访问等等,一般会耗费1天时间,甚至2天时间,若手头安装盘不齐全,需要耗费更多时间. 2:远程传输安装文件.特别是开发环境等 ...