在每次訪問action的之前經過過濾器過濾敏感字詞
思路如下,代碼需要按照你的具體情況定了. 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對象.