轉載自:http://kabuka.iteye.com/blog/1412528
html
FilterDispatcher是struts2.0.x到2.1.2版本的核心過濾器.! java
StrutsPrepareAndExecuteFilter是自2.1.3開始就替代了FilterDispatcher的.!給你打個比喻, 如今有病人要作手術, 如今struts2要作兩件事, 搭病牀(環境),執行手術.! 那麼打麻藥的工做呢.? 不可能要病人站着打吧, 因此必須有病牀的環境,打完麻藥以後再動手術.! 這個比喻很是形象了.! jsp
---------------------------------------------------------------------------------------------------------------------------------我的補充: spa
使用Context.getContext()時,會有不一樣的效果。 code
在方法體外,如 htm
public class TestAction extends ActionSupport{ protected Map request =(Map)ActionContext.getContext().get("request"); public String execute(){} }
若是是使用舊版的FilterDispatcher,request將爲null,而用StrutsPrepareAndExecuteFilter,則能夠得到值。 blog