session中或者request中同名字的参数会被后来者覆盖
2016-01-20 14:12
369 查看
服务器1:
public void test1() throws IOException{
ActionContext ctx = ActionContext.getContext();
HttpServletRequest request = (HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST);
HttpServletResponse response = (HttpServletResponse)ctx.get(ServletActionContext.HTTP_RESPONSE);
ctx.getSession().put("str", "1234567890+++++++实验成功了");
String port= request.getLocalPort()+"";
System.out.println("端口号为:"+port);
response.sendRedirect("http://localhost:8080/项目1 /命名空间1/test1.action");
}
public String test2() throws IOException{
ActionContext ctx = ActionContext.getContext();
HttpServletRequest request = (HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST);
HttpServletResponse response = (HttpServletResponse)ctx.get(ServletActionContext.HTTP_RESPONSE);
ctx.getSession().put("str", "1234567890+++++++实验成功了???????覆盖掉就对了");
return "success";
}
服务器2
public void test1() throws IOException{
ActionContext ctx = ActionContext.getContext();
HttpServletRequest request = (HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST);
HttpServletResponse response = (HttpServletResponse)ctx.get(ServletActionContext.HTTP_RESPONSE);
response.sendRedirect("http://localhost:8080/项目2 /命名空间2/test2.action");
}
页面
...
<%@ taglib uri="/struts-tags" prefix="s" %>
...
${str}<br>
public void test1() throws IOException{
ActionContext ctx = ActionContext.getContext();
HttpServletRequest request = (HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST);
HttpServletResponse response = (HttpServletResponse)ctx.get(ServletActionContext.HTTP_RESPONSE);
ctx.getSession().put("str", "1234567890+++++++实验成功了");
String port= request.getLocalPort()+"";
System.out.println("端口号为:"+port);
response.sendRedirect("http://localhost:8080/项目1 /命名空间1/test1.action");
}
public String test2() throws IOException{
ActionContext ctx = ActionContext.getContext();
HttpServletRequest request = (HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST);
HttpServletResponse response = (HttpServletResponse)ctx.get(ServletActionContext.HTTP_RESPONSE);
ctx.getSession().put("str", "1234567890+++++++实验成功了???????覆盖掉就对了");
return "success";
}
服务器2
public void test1() throws IOException{
ActionContext ctx = ActionContext.getContext();
HttpServletRequest request = (HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST);
HttpServletResponse response = (HttpServletResponse)ctx.get(ServletActionContext.HTTP_RESPONSE);
response.sendRedirect("http://localhost:8080/项目2 /命名空间2/test2.action");
}
页面
...
<%@ taglib uri="/struts-tags" prefix="s" %>
...
${str}<br>
相关文章推荐
- 最长公共子序列LongestCommonSubsequence
- Java语言中String 、StringBuffer 、StringBuilder的区别
- ssh提示输入密码回显
- ContactsUI(修改联系人)
- ssm+easyui(框架的搭建)
- 转 UCGUI字体解释
- android query的用法
- UITableView取消某一个cell的分割线
- 给 UIButton、UILabel添加下划线
- .net邮件错误 :The specified string is not in the form required for a subject.
- SQL Server 2016 查询存储(Query Store)示例
- SQL Server 2016 查询存储(Query Store)示例
- x-requested-with 判断是否是Ajax异步请求
- 486E - LIS of Sequence(LIS)
- ANT build.xml文件详解(一)
- OncePerRequestFilter
- Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
- 从客户端(XML)中检测到有潜在危险的 Request.Form 值。
- Django数据库queryset操作
- Access restriction: The type BASE64Encoder is not accessible due to restrict