一、作用

可以作为一个数据中转站,用在前台和后台数据传递

二、生命周期

ValueStack的生命周期是随着request的创建而创建,随request的销毁而销毁。

三、结构

OgnlValueStack类实现了ValueStack接口,类中有两个至关重要的东西:

1.CompoundRoot root 根对象栈

通过OGNL可以访问根对象相关联的其他对象

CompoundRoot继承了ArrayList类,即使一个集合,详见源码CompoundRoot类。

访问根对象栈时直接写对象名,或者#root.对象名(context中有root的引用)

1.group.org.orgId
2.#root.group.org.orgId

2.transient Map<String,Object> context Map栈

  通过OGNL可以访问多个毫不相干的对象

通过#对象名来访问context中的对象

Struts2 ValueStack的更多相关文章

  1. struts2 ValueStack(值栈)解析

    Struts2一个重要点就是值栈. ValueStack,是用来存储一些在各个action,或者说是通过s标签.el表达式等给前台Jsp等页面展示的东西. ValueStack是一个接口,其内部接口非 ...

  2. struts2 ValueStack的作用

    Value Stack的作用: 1.       可以作为一个数据中转站 2.       用于在前台-后台之间传递数据,最典型的做法就是struts2标签也ognl表达式的结合.我用得最多的就是数据 ...

  3. struts2 ValueStack的set方法与setValue方法的区别

    struts2中 ValueStack的set方法与setValue方法的区别呢? 示例代码: ActionContext.getContext().getValueStack().setValue( ...

  4. struts2 ValueStack详解,页面获取值el表达式、ognl表达式

    http://www.blogjava.net/max/archive/2007/04/28/114417.html 我想用的是el表达式! http://www.cnblogs.com/belief ...

  5. Struts2学习第3天--OGNL、EL、值栈

    JAVA中的OGNL: 1 调用对象的方法: 2 访问对象的静态方法: 3 获取OGNLContext.Root中的数据. User: 4 访问Context: 关键还是在Struts2环境中的使用: ...

  6. Struts2.0笔记二

    Mvc与servlet 1.1   Servlet的优点 1.  是mvc的基础,其他的框架比如struts1,struts2,webwork都是从servlet基础上发展过来的.所以掌握servle ...

  7. Struts(十二):异常处理:exception-mapping元素

    配置当前action的声明异常处理 1.exception-mapping元素中有2个属性 exception:指定需要捕获的异常类型 result:指定一个响应结果,该结果将在捕获到异常时被执行.即 ...

  8. Struts(十一):OGNL表达式(二)

    Map栈 :request,session,application的一个属性值或一个请求参数的值. 若想访问ContextMap里的某个对象的属性,可以使用以下几种之一: #object.proper ...

  9. Struts(十):OGNL表达式(一)

    Struts2 用s:porperty标签和OGNL表达式来读取值栈中的属性值: I.值栈中的属性值: 1.对象栈:读取对象栈中的某一个对象的属性值: 2.Map栈 :request,session, ...

随机推荐

  1. iOS版 hello,world版本2

    // // main.m // Hello // // Created by lishujun on 14-8-28. // Copyright (c) 2014年 lishujun. All rig ...

  2. struts.enable.DynamicMethodInvocation = true 动态方法调用

    default.properties 在Struts 2的核心jar包-struts2-core中,有一个default.properties的默认配置文件.里面配置了一些全局的信息,比如: stru ...

  3. Reactor Cooling

    sgu194:http://acm.sgu.ru/problem.php?contest=0&problem=194 题意:题目大意:给n个点,及m根pipe,每根pipe用来流躺液体的,单向 ...

  4. 【POJ2699】The Maximum Number of Strong Kings(网络流)

    Description A tournament can be represented by a complete graph in which each vertex denotes a playe ...

  5. C语言头文件的作用

    C99中规定, 所有顶层的默认存储类标志符都是extern ! 头文件中声明的函数,默认都是extern前缀.但是为了我们程序员方便,我们采取下面的手段: 我个人认为是extern催生了头文件的诞生. ...

  6. Delphi与Java中的日期互换

    在最近做的一个项目中用到了Java和Delphi,发现它们不能正确读取对方的日期类型,如在Java中写入一个值为“2007-12-1”的日期值,通过Delphi读取却不是这个值了.通过查阅资料,发现两 ...

  7. [LeetCode#84]Largest Rectangle in Histogram

    Problem: Given n non-negative integers representing the histogram's bar height where the width of ea ...

  8. Android protectionLevel

    Android protectionLevel分4个级别: "normal" "dangerous" "signature" "s ...

  9. 【转】OpenGL基础图形编程(二)

    原文:http://blog.chinaunix.net/uid-20638550-id-1909184.html  分类: 十一.位图与图像 11.1.位图 11.1.1 位图(Bitmap)与字符 ...

  10. POJ 1159 Palindrome 最长公共子序列的问题

    Description A palindrome is a symmetrical string, that is, a string read identically from left to ri ...