struts2伪静态的方法

       步骤:(1)、增加struts的扩展名<constant name="struts.action.extension" value="action,htm" />,struts2拥有了两个扩展名action和htm

                 (2)、  在web.xml中配置struts2的核心控制器将*.ation,*.htm的请求交给struts2来处理

<filter>
        <filter-name>struts2</filter-name>
        <filter-class>
            org.apache.struts2.dispatcher.FilterDispatcher
        </filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>*.action</url-pattern>
    </filter-mapping>
    <filter-mapping>希望大家支持千山暮雪
        <filter-name>struts2</filter-name>
        <url-pattern>*.htm</url-pattern>
    </filter-mapping>

(3)、配置具体的action

<package name="news" extends="struts-default" namespace="/index">

        <action name="*" class="com.moonteam.struts2.action.ViewNewsAction" >
            <param name="paramName"  >{1}</param>
             <result name="success">index.jsp</result>
        </action>

</package>

原文地址:https://www.cnblogs.com/sky7034/p/2359864.html