开发者

Confusion with web.xml file for Struts2

I am trying to learn Struts2. When I see the web.xml file for Struts2 in some of the sites it's mentioned as:

<filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>

and where as in some ex开发者_如何转开发amples its mentioned as:

<filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>

Could anybody please help me? What is correct and why is it there are two approaches?

Thank you very much.


The FilterDispatcher (org.apache.struts2.dispatcher.FilterDispatcher) it’s deprecated since Struts 2.1.3. It’s always recommend to use StrutsPrepareAndExecuteFilter


Basically StrutsPrepareAndExecuteFilter been introduced due to variety of reasons

  1. older filter setup was confusing and led to issues
  2. The new setup also was forward looking towards the OSGi plugin.
  3. Better enable customizations and overrides by advanced users

for further information follow the below mentioned thread

New filter strategy RFC Struts2

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜