Struts2:在Interceptor中获取action中的参数值
来源:互联网 发布:java中printf格式化输 编辑:程序博客网 时间:2024/05/16 08:53
1.jsp:
username:<input type="text" name="username"><br>
password:<input type="password" name="password"><br>
2.在action中获取到jsp页面传递的值:
HttpServletRequest request = ServletActionContext.getRequest();
String username = request.getParameter("username");
String password = request.getParameter("password");
3.在Interceptor中获取action中的username
首先,在action中,需要将username存放到session中:
request.getSession().setAttribute("username", username);
在Interceptor中,通过session获取到action中的username:
String username = (String) ServletActionContext.getRequest().getSession().getAttribute("username");
0 0
- Struts2:在Interceptor中获取action中的参数值
- struts2 在action中获取地址栏的参数
- struts2 在action中获取地址栏的参数
- 在struts2中获取请求action名称或参数
- struts2 在action中获取地址栏的参数
- Struts2配置文件中获取Action中设置的参数值
- struts2中action获取jsp页面参数
- struts2中action手动获取参数
- Interceptor在Struts2中的应用...
- 在Struts2拦截器中获取请求action名称及参数
- 在Struts2拦截器中获取请求action名称及参数
- struts2——文件的下载以及在Action中获取请求参数的方式
- 在filter中获取action的参数值
- 在JS代码中获取Struts2中的返回值或者参数
- 在JS代码中获取Struts2中的返回值或者参数
- struts2 xml中获取 action中传递参数
- struts2在struts.xml文件中获取或设置action中的属性
- struts2在Action中获取Scope中的对象request、session、application
- UItableView
- Poj 1061 青蛙的约会(扩展欧几里得)
- 1096. Consecutive Factors (20)
- App Store App申请审核加速
- c语言之素数距离问题
- Struts2:在Interceptor中获取action中的参数值
- 用ArrayList存储数据实现队列功能(写着玩的)
- 不忘初心
- Android-获取GPS数据方法
- 【黑马程序员】网络编程——Java复习笔记
- linux 常用命令
- Makefile下 $(wildcard $^),$^,$@,$?,$<,$(@D),$(@F)
- 10007---Java中从控制台输入数据的几种常用方法
- POJ2407 欧拉函数