Struts2_API
1.访问servletAPI方法1
public String execute() throws Exception {
//request域对象==》map (struts2并不推荐使用原生request域对象)
//不推荐
Map<String, Object> requestScope = (Map<String, Object>) ActionContext.getContext().get("request");
//推荐
ActionContext.getContext().put("name", "requestTom");
//session域对象==》map
Map<String, Object> sessionScope = ActionContext.getContext().getSession();
sessionScope.put("name", "sessionTom");
//application域对象==》map
Map<String, Object> applicationScope = ActionContext.getContext().getApplication();
applicationScope.put("name", "applicationTom");
return SUCCESS;
}
request:${requestScope.name}<br> session:${sessionScope.name}<br> application:${applicationScope.name}<br>
Struts2_API的更多相关文章
随机推荐
- Redis——windows下如何连接Linux(centos7.x)虚拟机的Redis——【二】
我的虚拟网络使用的是桥接网络和windows主机IP为同一网段,做下面步骤之前请确保网络通畅. 使用cmd的ping来测试 软件 https://redisdesktop.com/download 下 ...
- Android InputType
转载: http://blog.csdn.net/wei_zhi/article/details/50094503 在Android开发过程中,我们经常使用到EditText控件,并且会根据各种需求设 ...
- Codeforces Round #518 (Div. 2) B. LCM gcd+唯一分解定律
题意:给出b 求lcm(a,b)/a 在b从1-1e18有多少个不同得结果 思路lcm*gcd=a*b 转换成 b/gcd(a,b) 也就是看gcd(a,b)有多少个值 可以把b 由唯一分解 ...
- BZOJ3230 相似子串 【后缀数组】
题目分析: 容易想到sa排好序之后,子串排名就是前面的子串减去height数组.所以正着做一遍,倒着做一遍就行了. 代码: #include<bits/stdc++.h> using na ...
- CODEFORCES掉RATING记 #3
比赛:Codeforces Round #426 (Div. 2) 时间:2017.7.30晚 开场先看AB A:给你两个方向,和旋转次数(每次旋转90度),问你旋转方向是什么 B:给你一个字符串,问 ...
- 在VS中安装nuget离线包nupkg文件
1.下载 nupkg文件 2.打开VS,工具,选项,如下图,复制右侧圈圈地址,把下载文件复制丢进去 3.管理当前解决方案的nuget包 n 4.左侧选择你下载的包名,在右侧选择需要安装在哪一层项目,点 ...
- 【hdu 5628】Clarke and math (Dirichlet卷积)
hdu 5628 Clarke and math 题意 Given f(i),1≤i≤n, calculate \(\displaystyle g(i) = \sum_{i_1 \mid i} \su ...
- UDS(ISO14229-2006) 汉译(No.7 应用层协议)
标签:cte amp 通信 pac condition man 没有 参数错误 family 7.1定义 应用层协议通常作为确认消息的传输,意味着从客户端发送的每一个请 ...
- java thread 线程40个问题汇总
http://www.codeceo.com/article/40-java-thread-problems.html 1.多线程有什么用? 一个可能在很多人看来很扯淡的一个问题:我会用多线程就好了, ...
- JS截取文件后缀名
let fileName = this.file.name.lastIndexOf(".");//取到文件名开始到最后一个点的长度 let fileNameLength = thi ...