Struts 2 > web.xml 2.1.x compatibility |

Struts 2
web.xml 2.1.x compatibility
Edit Page Browse Space Add Page Add News
Added by plightbo, last edited by Ted Husted on Sep 03, 2006 (view change)

Before WebWork 2.2, a ServletDispatcher was used to handle action requests. In addition, JSP tags were emulated from within Velocity. WebWork 2.2 made a key changes in this area: The ServletDispatcher was deprecated and replaced with a FilterDispatcher. This generally works perfectly for users who follow the best practices of WebWork, which is what version 2.2 is pushing. However, due to some small behavioral changes in WebWork 2.2, older applications may require the ServletDispatcher.

The biggest change to note is that any application that was including another action, either via a result dispatcher or jsp/ww:include tag, no longer works with the FilterDispatcher. This is because Servlet containers don't support RequestDispatchers out to filter mappings - only servlet mappings are supported. To get around this, you can either change your code to use action chaining in liue of a result dispatcher and the ww:action tag in liue of a jsp/ww:include.

As a consequence of switching the FilterDispatcher, JSP tag emulation from within Velocity does not work. While this feature was never fully robust and supported, we recognize that many users take advantage of this feature. As of WebWork 2.2, native Velocity tags are supplied and are the only supported tags within WebWork/Velocity integration.

However, we do provide a deprecated way to avoid changing your code. We recommend that when possible you update your code as suggested. In the meantime, you may add the following Servlets to web.xml:

Content pulled from external source. Click here to refresh.
    <servlet>
        <servlet-name>JspSupportServlet</servlet-name>
        <servlet-class>com.opensymphony.webwork.views.JspSupportServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>com.opensymphony.webwork.dispatcher.ServletDispatcher</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.action</url-pattern>
    </servlet-mapping>