From c5c55a02fbdbdb0f5c357b0c006868c5bc657069 Mon Sep 17 00:00:00 2001 From: yemengsky Date: Tue, 15 Dec 2015 16:18:20 +0800 Subject: [PATCH 1/3] run failure bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 这里不能要这一行,不然会出错。 --- chapter_2/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chapter_2/README.md b/chapter_2/README.md index 1dc3d7b..ada3f52 100644 --- a/chapter_2/README.md +++ b/chapter_2/README.md @@ -147,10 +147,10 @@ rose手册第二章:配置与使用 - - log4jConfigLocation - /WEB-INF/log4j.xml - + org.springframework.web.util.Log4jConfigListener From 20ff4bf03e571b486ab9678af99fe45f7e2cfda0 Mon Sep 17 00:00:00 2001 From: yemengsky Date: Wed, 16 Dec 2015 17:02:12 +0800 Subject: [PATCH 2/3] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新jsp文件的view展示 --- chapter_3_1/README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/chapter_3_1/README.md b/chapter_3_1/README.md index 7efb72d..2152db6 100644 --- a/chapter_3_1/README.md +++ b/chapter_3_1/README.md @@ -175,8 +175,24 @@ comment.jsp的代码如下: model.add("commentContent", "今天来人不少,我很欣慰啊!"); return "comment"; } +总结一句话,通过rose提供类net.paoding.rose.web.var.Model来设置变量名和变量值,然后在视图文件中用“${paramName}”的方式得到变量值。但是,需要在pom文件添加以下内容: + + ... + + javax.servlet + servlet-api + 2.5 + provided + + + + javax.servlet + jstl + 1.2 + + ... + -总结一句话,通过rose提供类net.paoding.rose.web.var.Model来设置变量名和变量值,然后在视图文件中用“${paramName}”的方式得到变量值。 变量的值可以是String,boolean,数字,数组,对象(JavaBean)。 如果是对象,使用方法如下: From 07ad6a29e11206af21756ebbb95c53a94758d3dd Mon Sep 17 00:00:00 2001 From: yemengsky Date: Thu, 17 Dec 2015 09:48:10 +0800 Subject: [PATCH 3/3] add JSON support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加JSON输出时,需要的JSON支持 --- chapter_3_1/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/chapter_3_1/README.md b/chapter_3_1/README.md index 2152db6..3720c1b 100644 --- a/chapter_3_1/README.md +++ b/chapter_3_1/README.md @@ -261,6 +261,17 @@ rose中,controller方法的返回值有下面几种规则: } 将会返回一个字符串(jo.toString()),并自动将“HttpServletResponse”中的“contentType”设置为“application/json”。 +需要在pom文件添加JSON支持,: + + ... + + com.alibaba + fastjson + 1.2.7 + + ... + + 4.【不推荐使用】以“r:”开头的字符串,比如“return "r:/aaa";”,等效于调用“javax.servlet.http.HttpServletResponse.sendRedirect("/aaa")”,将执行301跳转。 5.【不推荐使用】以“a:”开头的字符串,比如“return "a:/bbb";”,将会携带参数再次匹配roseTree,找到controller中某个方法并执行,相当于“javax.servlet.RequestDispatcher.forward(request, response)”。