package com.code.tate.spring.restful.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
@RequestMapping("/restful")
@Controller
public class RESTController {
@RequestMapping(value = "/show", method = RequestMethod.GET)
public ModelAndView show() {
System.out.println("show");
ModelAndView model = new ModelAndView("xStreamMarshallingView");
model.addObject("show method");
return model;
}
@RequestMapping(value = "/get/{id}", method = RequestMethod.GET)
public ModelAndView getUserById(@PathVariable String id) {
System.out.println("getUserById-" + id);
ModelAndView model = new ModelAndView("xStreamMarshallingView");
model.addObject("getUserById method -" + id);
return model;
}
@RequestMapping(value = "/add", method = RequestMethod.POST)
public ModelAndView addUser(String user) {
System.out.println("addUser-" + user);
ModelAndView model = new ModelAndView("xStreamMarshallingView");
model.addObject("addUser method -" + user);
return model;
}
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
public ModelAndView editUser(String user) {
System.out.println("editUser-" + user);
ModelAndView model = new ModelAndView("xStreamMarshallingView");
model.addObject("editUser method -" + user);
return model;
}
@RequestMapping(value = "/remove/{id}", method = RequestMethod.DELETE)
public ModelAndView removeUser(@PathVariable String id) {
System.out.println("removeUser-" + id);
ModelAndView model = new ModelAndView("xStreamMarshallingView");
model.addObject("removeUser method -" + id);
return model;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
maven-spring-restful-test
共35个文件
prefs:9个
xml:7个
java:6个
4星 · 超过85%的资源 需积分: 10 11 下载量 57 浏览量
2016-06-09
23:55:44
上传
评论
收藏 27KB ZIP 举报
温馨提示
maven项目模版,里面有springMVC配置restful的后台代码例子,使用spring-test单元测试。
资源推荐
资源详情
资源评论
收起资源包目录
com.code.tate.zip (35个子文件)
trunk
spring.restful
pom.xml 2KB
.settings
org.eclipse.m2e.core.prefs 90B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.wst.common.project.facet.core.xml 252B
org.eclipse.core.resources.prefs 191B
org.eclipse.wst.common.component 711B
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.validation.prefs 50B
.jsdtscope 575B
org.eclipse.jdt.core.prefs 430B
src
test
resources
config.properties 670B
applicationContext-core.xml 3KB
java
com
code
tate
spring
restful
RESTClient.java 978B
RESTClientTest.java 840B
controller
RESTControllerTest.java 211B
main
webapp
WEB-INF
web.xml 941B
index.jsp 52B
resources
config.properties 670B
applicationContext-core.xml 3KB
java
com
code
tate
spring
restful
controller
RESTController.java 2KB
.project 1KB
.classpath 1KB
pom.xml 8KB
.myumldata 66B
helloword.test
pom.xml 2KB
.settings
org.eclipse.m2e.core.prefs 102B
org.eclipse.core.resources.prefs 119B
org.eclipse.jdt.core.prefs 243B
src
test
java
com
code
tate
helloword
test
AppTest.java 656B
main
java
com
code
tate
helloword
test
App.java 191B
.project 580B
.classpath 1024B
.settings
org.eclipse.m2e.core.prefs 90B
org.eclipse.core.resources.prefs 55B
.project 393B
共 35 条
- 1
资源评论
- llovizna2018-01-03还以为是spring mvc配置restful的例子,也就是后台请求的demo。实际上却是前台调用后台的方法。针对前后台调用的demo来看,这个例子还是简单且可理解的,但是标题却有点误解了。
Tate-Ling
- 粉丝: 27
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 3122080306 邹子轩 实验报告二.docx
- 基于STM32 NUCLEO板设计彩色LED照明灯(纯cubeMX开发)(大赛作品,文档完整,可直接运行)
- 发那科工业机器人保养大全
- Sphere.h
- REMD固有时间尺度分解信号分量可视化(Matlab完整源码和数据)
- 嵌入式系统双单片机STC89C52+STC15W104多功能学习板电路图可扩展 适用于单片机初学者和教学
- 基于STM32蓝牙控制小车系统设计(硬件+源代码+论文)大赛作品
- XILINXFPGA源码基于Spartan3火龙刀系列FPGA开发板VGA测试例程
- Java聊天室的设计与实现【尚学堂·百战程序员】
- python中matplotlib教程
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功