OGNL相关代码
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body> <%
application.setAttribute("app", "application的内容");
session.setAttribute("ses", "会话的测试");
request.setAttribute("req", "request的内容"); application.setAttribute("ses", "123123");
session.setAttribute("app", "会话的测12313试"); %>
<a href=""></a> <a href="test?userID=9999&date=123">下一个页面</a> <a href="testtag?userID=aaaaa">下一个页面</a> </body>
</html>
<%@page import="java.util.Date"%>
<%@page import="com.opensymphony.xwork2.util.ValueStack"%>
<%@page import="com.opensymphony.xwork2.ActionContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> <%@ taglib prefix="s" uri="/struts-tags"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body> <%
ActionContext ac = ActionContext.getContext(); ValueStack vs = ac.getValueStack(); //弹出顶部的对象
//Date dt = (Date)vs.pop(); //得到顶部对象
//Date dt = (Date)vs.peek();
//out.print(dt); %> 使用OGNL访问值栈
<br><br> EL方式
${date }<br>
${userID }
<br>
访问map栈
${sessionScope.ses } <br>
标签方式
<s:property value='[1]["date"]'/>
<s:property value= "userID"/>
<br>
<s:property value="[1].date"/>
<br> <s:property value="[0].userID"/> <br>
输出顶部对象
<s:property/> <br>
访问map栈
<s:property value="#session.ses"/>
<br>
<s:property value="#parameters.userID"/>
<br>
<s:property value= "#application.app"/>
<br>
<s:property value= "#request.req"/>
<br>
<s:property value= "#attr.ses"/> <br>
调用实例方法:
产生随机数=<s:property value="[0].nextInt(100)"/> <br>
调用静态属性和静态方法:
随机数=<s:property value="@java.lang.Math@random()"/>
<br>
PI=<s:property value="@java.lang.Math@PI"/>
<br> 访问List类型的对象
<br>
List的长度=<s:property value="[0].size()"/>
<br>
<s:property value="[0].get(0)"/> <br><br>
访问对象的集合属性
长度=<s:property value="[0].myList.size()"/>
<br>
内容=<s:property value= "[0].myList[]"/>
<br>
内容0=<s:property value= "[0].myList[0]"/>
<br>
是否为空=<s:property value="[0].myList.isEmpty"/> <!-- 打印到界面 -->
<s:debug></s:debug> </body>
</html>
OGNL相关代码的更多相关文章
- [ARM] Cortex-M Startup.s启动文件相关代码解释
1. 定义一个段名为CSTACK, 这里: NOROOT表示如何定义的段没有被关联,那么同意会被优化掉,如果不想被优化掉就使用ROOT. 后面的括号里数字表示如下: (1):这个段是2的1次方即2字节 ...
- Kafka Producer相关代码分析【转】
来源:https://www.zybuluo.com/jewes/note/63925 @jewes 2015-01-17 20:36 字数 1967 阅读 1093 Kafka Producer相关 ...
- 命令行方式使用abator.jar生成ibatis相关代码和sql语句xml文件
最近接手一个老项目,使用的是数据库是sql server 2008,框架是springmvc + spring + ibatis,老项目是使用abator插件生成的相关代码,现在需要增加新功能,要添加 ...
- myBatis自动生成相关代码文件配置(Maven)
pom.xml文件添加配置 <build> <finalName>generator</finalName> <plugins> <!-- mav ...
- 临时2级页表的初始化过程 head_32.S 相关代码解释
page_pde_offset = (__PAGE_OFFSET >> 20); /* __PAGE_OFFSET是0xc0000000,page_pde_offset = 3072 = ...
- 使用Mybatis Generator自动生成Mybatis相关代码
本文将简要介绍怎样利用Mybatis Generator自动生成Mybatis的相关代码: 一.构建一个环境: 1. 首先创建一个表: CREATE TABLE pet (name VARCHAR(2 ...
- K:树、二叉树与森林之间的转换及其相关代码实现
相关介绍: 二叉树是树的一种特殊形态,在二叉树中一个节点至多有左.右两个子节点,而在树中一个节点可以包含任意数目的子节点,对于森林,其是多棵树所组成的一个整体,树与树之间彼此相互独立,互不干扰,但其 ...
- js 横屏 竖屏 相关代码 与知识点
<!DOCTYPE html> <html> <head> <title></title> </head> <body&g ...
- 转:关于Latent Dirichlet Allocation及Hierarchical LDA模型的必读文章和相关代码
关于Latent Dirichlet Allocation及Hierarchical LDA模型的必读文章和相关代码 转: http://andyliuxs.iteye.com/blog/105174 ...
随机推荐
- 苹果mac电脑中brew的安装使用及卸载详细教程
brew 又叫Homebrew,是Mac OSX上的软件包管理工具,能在Mac中方便的安装软件或者卸载软件, 只需要一个命令, 非常方便 brew类似ubuntu系统下的apt-get的功能 安装br ...
- 利用 HashSet 去过滤元素是否重复
HashSet<Integer> hashSet = new HashSet<Integer>(); for (int i = resultDoctorDetails.size ...
- Java:单例模式的七种写法
第一种(懒汉,线程不安全): 1 public class Singleton { 2 private static Singleton instance; 3 private Singleton ( ...
- javascript中三种典型情况下this的含义
this本意:基于函数的执行环境绑定. 1)一般函数内部,返回的是window(作用域链中的第二层全局作用域) function test() { return this; } alert(test( ...
- 使用 Graphviz 画拓扑图
使用 Graphviz 画拓扑图 0)前述 本文着重讲一下 Graphviz 的风格控制,基础一些的就不在这里讲啦. graphviz 的主页是http://www.graphviz.org/. Gr ...
- Struts2中跳转问题
struts2 跳转类型 result type=chain.dispatcher.redirect(redirect-action) dispatcher 为默认跳转类型,用于返回一个视图资源(如: ...
- iOS Block理解
以前看到Block觉得也没什么,不就是类似函数的东西,这东西在C#里就是委托,在Java里就是块,有什么稀奇的.但看到一点进阶的内容后,发现这个东西确实有用. 所以做下总结. 一.块的基本用法 块的语 ...
- hibernate中SessionFactory与Session的作用
首先,SessionFactory是线程安全的,SessionFactory用到了工厂模式. 其创建和销毁需要耗费很大的资源,所以一个应用中的一个数据库一般只对应一个sessionfactory. S ...
- #1094 : Lost in the City
时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Little Hi gets lost in the city. He does not know where he is ...
- WPF整理-Style
"Consistency in a user interface is an important trait; there are many facets of consistency, ...