struts2

struts2就是把所有的请求进行了再次封装,过滤器为

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

    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

 

然后在struts.xml中进行响应的配置

<package name="test" namespace="/new" extends="struts-default">
        <action name="login" class="com.zkzk945.action.LoginAction">
            <result name="success">
                /success.jsp
            </result>
            <result name="fail">
                /fail.jsp
            </result>
        </action>
        
            <action name="mlogin" class="com.zkzk945.action.MLoginAction">
            <result name="success">
                /success.jsp
            </result>
            <result name="fail">
                /fail.jsp
            </result>
            <interceptor-ref name="modelDriven"></interceptor-ref>
            <interceptor-ref name="defaultStack"></interceptor-ref>
        </action>

 

源码

 

https://git.oschina.net/zkzk945/Struts2.git

你可能感兴趣的:(struts2)