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
- older filter setup was confusing and led to issues
- The new setup also was forward looking towards the OSGi plugin.
- Better enable customizations and overrides by advanced users
for further information follow the below mentioned thread
New filter strategy RFC Struts2
精彩评论