推荐于2016-08-08 18:36:54
最佳答案
思路如下,代码需要按照你的具体情况定了.
ActionInvocation的实例调用getInvocationContext() 获取 ActionContext实例,调用ActionContext实例的getParameters() 方法获取a Map of the HttpServletRequest parameters,最后从map中获取提交的表单值。
比如:
String username= (String)actionInvocation.getInvocationContext.getParameters(). get("username");
还有一个solution就是从ActionInvocation中获取ActionContext后,调用getSession()获取到HttpSession,在从session中获取用户的输入值。
我们一般直接操作这个Map对象进行对session的写入和读取操作, 而不用去直接操作HttpSession对象.
希望我的回答帮助你解决问题。
本文介绍如何在ActionInvocation中通过getInvocationContext和getParameters方法获取用户提交的所有表单值,包括敏感词过滤的方法。
174

被折叠的 条评论
为什么被折叠?



