Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run failure bug #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions chapter_2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ rose手册第二章:配置与使用
</welcome-file-list>


<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.xml</param-value>
</context-param>
<!-- <context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.xml</param-value>
</context-param> -->

<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
Expand Down
29 changes: 28 additions & 1 deletion chapter_3_1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,24 @@ comment.jsp的代码如下:
model.add("commentContent", "今天来人不少,我很欣慰啊!");
return "comment";
}
总结一句话,通过rose提供类net.paoding.rose.web.var.Model来设置变量名和变量值,然后在视图文件中用“${paramName}”的方式得到变量值。但是,需要在pom文件添加以下内容:

...
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
...


总结一句话,通过rose提供类net.paoding.rose.web.var.Model来设置变量名和变量值,然后在视图文件中用“${paramName}”的方式得到变量值。
变量的值可以是String,boolean,数字,数组,对象(JavaBean)。

如果是对象,使用方法如下:
Expand Down Expand Up @@ -245,6 +261,17 @@ rose中,controller方法的返回值有下面几种规则:
}

将会返回一个字符串(jo.toString()),并自动将“HttpServletResponse”中的“contentType”设置为“application/json”。
需要在pom文件添加JSON支持,:

...
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.7</version>
</dependency>
...



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)”。
Expand Down