通过多种方式获取作用域并设置的值是否存储在值栈
来源:互联网 发布:淘宝店铺上传图片 编辑:程序博客网 时间:2024/06/04 00:49
测试的为request作用域
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %><%@ page import="com.opensymphony.xwork2.ActionContext" %><%@ page import="org.apache.struts2.ServletActionContext" %><%@ page import="javax.servlet.http.HttpServletRequest" %><%@ page import="com.opensymphony.xwork2.util.ValueStack" %><%@ page import="java.util.Map" %><%@ taglib prefix="s" uri="/struts-tags" %><%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %><html><head></head><body><% Map request1=(Map)ActionContext.getContext().get("request"); request1.put("gjh1", "gjh1");HttpServletRequest request2 = ServletActionContext.getRequest();request2.setAttribute("gjh2", "gjh2");ValueStack valuestack=ActionContext.getContext().getValueStack();valuestack.setValue("#request.gjh3", "gjh3");ActionContext ctx = ActionContext.getContext(); HttpServletRequest request4 = (HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST); request4.setAttribute("gjh4", "gjh4");%><h1><%= request1==request2 %></h1><br/><h1><%= request1==request4 %></h1><br/><h1><%= request2==request4 %></h1><br/><h1>${requestScope.gjh1}</h1><br/><h1>${requestScope.gjh2}</h1><br/><h1>${requestScope.gjh3}</h1><br/><h1>${requestScope.gjh4}</h1><br/><h1><s:property value="#request.gjh1"/></h1><br><h1><s:property value="#request.gjh2"/></h1><br><h1><s:property value="#request.gjh3"/></h1><br><h1><s:property value="#request.gjh4"/></h1><br></body></html>
运行结果
运行结果表示全部存储在值栈
比较结果不相等是因为request里面封装的是map,而获得的map是直接操作的map,所以比较的结果不相等
阅读全文
0 0
- 通过多种方式获取作用域并设置的值是否存储在值栈
- UITableView获取cell的indexPath.row值(多种方式)
- 通过JS的方式获取input标签下的name参数的值并修改?
- redis是key-value存储的,放在内存中,并在磁盘持久化的数据结构存储系统 通过set key value来存储,通过get key来获取值 复制代码 set key value:设
- 通过 JS 注入获取和设置input域的值
- 演示了通过存储过程来获取某个字段的值,并对该字段值进行了判断
- 变量的作用域和存储方式
- 变量的存储方式及作用域
- 变量的作用域和存储方式
- php 中获取远程用户ip的三种方式,并判定ip是否在一定的范围之内
- jquery获取checkbox的值并判断是否选中
- 反射第五步 : 通过反射获取某一个类的字段值,并设置字段值 (很少用)
- spring boot 获取properties 属性值 多种方式
- struts2 (二)单元测试/通过耦合和非耦合的方式获取和设置值/返回值类型/异常映射
- PHP获取IP的多种方式解析
- PHP获取IP的多种方式解析
- PHP获取IP的多种方式解析
- 获取Class对象的多种方式
- Reverse Integer
- 并发与并行
- android 架构
- 作用域
- Python爬虫-爬取爆米花视频下载至本地
- 通过多种方式获取作用域并设置的值是否存储在值栈
- 2017-10-12
- polarssl rsa & aes 加密与解密
- 边学边敲
- mybatis常用jdbcType数据类型
- 中文文本挖掘预处理流程总结
- 全系列Android源代码在线浏览网站
- HDPCD-Java-复习笔记(7)- lab
- 取消cp别名'cp -i'(unalias)