package demo.controllers;
import demo.model.User;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import demo.service.DemoService;
import net.paoding.rose.web.annotation.Param;
import net.paoding.rose.web.annotation.Path;
import net.paoding.rose.web.annotation.rest.Get;
@Path("demo")
public class DemoController {
@Autowired
private DemoService demoService;
@Get("hello")
public String hello() {
System.out.println("hello rose");
return "@first hello";
}
@Get("json")
public String json() {
User user=new User();
user.setId(10);
user.setName("张三");
user.setAge(20);
JSONObject jsonObject = new JSONObject(user);;
return "@" + jsonObject;
}
@Get("user")
public String user(@Param("id") Integer id) {
User user = null;
try {
System.out.println(id);
user = demoService.test(id);
} catch (Exception e) {
e.printStackTrace();
}
return "@" + user.toString();
}
@Get("listUsers")
public String listUsers(HttpServletRequest request) {
List<User> users = null;
try {
users = demoService.listUsers();
} catch (Exception e) {
e.printStackTrace();
}
request.setAttribute("users", users);
return "user/user";
}
@Get("test/{id:[0-9]+}")
public String test(@Param("id") Integer id) {
User user = null;
try {
System.out.println(id);
user = demoService.test(id);
} catch (Exception e) {
e.printStackTrace();
}
return "@" + user.toString();
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
rose框架使用Demo
共65个文件
html:15个
xml:14个
java:5个
需积分: 32 11 下载量 53 浏览量
2017-07-21
14:30:05
上传
评论
收藏 129KB ZIP 举报
温馨提示
rose是人人网、糯米网释出的、开源的高效Java web开发框架。该资源介绍deno的简单使用,项目包含对数据库的基本操作,附带数据库
资源推荐
资源详情
资源评论
收起资源包目录
roseDemo.zip (65个子文件)
user.sql 949B
Paoding Rose使用手册 - winwill2012的博客 - CSDN博客.html 288KB
rose1
pom.xml 3KB
.springBeans 479B
target
test-classes
demo
m2e-wtp
web-resources
META-INF
maven
mymaven
rose1
pom.xml 3KB
pom.properties 201B
MANIFEST.MF 112B
classes
org
springframework
core
JdkVersion.class 1KB
demo
dao
DemoDAO.class 613B
model
User.class 1KB
test
controllers
DemoController.class 3KB
service
DemoService.class 896B
applicationContext.xml 1KB
test-output
junitreports
TEST-demo.test.NewTest.xml 2KB
TEST-com.lyz.NewTest.xml 3KB
TEST-com.lyz.TestController.xml 2KB
old
index.html 731B
Default suite
Default test.properties 34B
main.html 119B
testng.xml.html 693B
methods-alphabetical.html 778B
reporter-output.html 39B
classes.html 523B
groups.html 38B
methods.html 778B
index.html 186B
toc.html 1KB
methods-not-run.html 50B
skipped.png 967B
emailable-report.html 3KB
testng-reports.css 5KB
failed.png 977B
index.html 13KB
jquery-1.7.1.min.js 92KB
testng-results.xml 3KB
passed.png 1019B
testng-reports.js 3KB
navigator-bullet.png 352B
collapseall.gif 157B
testng-failed.xml 475B
testng.css 312B
bullet_point.png 356B
Default suite
Default test.xml 2KB
testng-failed.xml 475B
Default test.html 5KB
.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.wst.common.component 656B
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.validation.prefs 50B
.jsdtscope 639B
org.eclipse.jdt.core.prefs 430B
src
test
java
main
webapp
WEB-INF
web.xml 1KB
log4j.xml 554B
views
user
user.jsp 616B
index.jsp 430B
resources
applicationContext.xml 1KB
java
org
springframework
core
JdkVersion.java 1KB
demo
dao
DemoDAO.java 438B
model
User.java 552B
controllers
DemoController.java 2KB
service
DemoService.java 503B
.project 1KB
.classpath 1KB
共 65 条
- 1
资源评论
qq_34851184
- 粉丝: 6
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功