Posted on 2005-08-16 18:56
胡冰 阅读(233)
评论(0) 编辑 收藏 网摘 所属分类:
webwork <!--
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<rdf:Description
rdf:about="http://www.cnblogs.com/suibing/articles/216262.html"
dc:identifier="http://www.cnblogs.com/suibing/articles/216262.html"
dc:title=""
trackback:ping="http://www.cnblogs.com/suibing/services/trackbacks/216262.aspx" />
</rdf:RDF>
-->
Action文件:
import com.opensymphony.xwork.ActionSupport;
public class HelloWebWorldAction extends ActionSupport {
String hello;
public String getHello() {
return hello;
}
public String execute() throws Exception {
hello = "Hello, WebWorld!";
return SUCCESS;
}
}
该action文件调用后转到下面的JSP
success.jsp:
<%@ taglib uri="webwork" prefix="ww" %>
<html>
<head>
<title></title>
</head>
<body>
<ww:property value="hello" />
</body>
其实,success.jsp:中的
<ww:property value="hello" /> ,也可以用一下方式得到:
<%
OgnlValueStack stack = (OgnlValueStack)request.getAttribute("webwork.valueStack");
out.write("Hello, " +java.util.Arrays.toString((String[][])stack.findValue("countries")));
out.write("Hello, " +stack.findValue("name"));
%>
注意,这个VS是存到request scope中的变量,其KEY是"webwork.valueStack",其中存放了很多信息
一下是一些默认的信息:
WebWork2 contains the following items by default in the ValueStack:
- req - the current HttpServletRequest
- res - the current HttpServletResponse
- stack - the current OgnlValueStack
- ognl - an instance of OgnlTool
- ui - a (now deprecated) instance of a ui tag renderer
VS(valueStack),从上面的分析中可以得知,VS被放入了request 中,所以可以由一下方式得到
<ww:property value="#request['webwork.valueStack']" />
在JAVA程序中可以这么得到
ActionContext.getContext().getValueStack()
分享到:
相关推荐
webwork in action 书籍 源代码
webwork in action
webwork in action 第一部分:概貌 第二部分:核心内容 第三部分:内容的显示 第四部分:高级话题
webwork in action 的中文版,影印,高清晰,本人阅读中。非常不错。文件太大了,分了 15个压缩文件。每个文件1分。
webwork in action 中文版
webwork in action 中文版
webwork in action 中文版
Webwork in action
webwork.in.action中文pdf版 part5
真正的webwork in Action中文清晰完整版,还附有书上的示例代码,不同于其它的章节摘录版,模糊版,英文版...学习webwork的最佳教材
webwork中文 webwork中文参考 webwork中文资料 webwork学习资料
第一部分:webwork 简介 第二部分: 核心概念 第三部分:内容显示 第四部分:高级话题
webwork.in.action中文pdf版
webwork.in.action中文版 pdf版本
webwork中文帮助文档 webwork中文帮助文档 webwork中文帮助文档 webwork中文帮助文档 webwork中文帮助文档 webwork中文帮助文档
webwork in action 电子书
Webwork.in.action最新中文版
Webwork入门 WebWork入门教程[创建你第一个WebWork action]