struts2 的 struts.xml配置的问题,为什么这样写放在WEB-INF下还是找不到action,只能放到src下
<filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher...
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
<init-param>
<param-name>config</param-name>
<param-value>
struts-default.xml,
struts-plugin.xml,
/WEB-INF/struts.xml
</param-value>
</init-param>
<!--
如果是2.1.3之前的版本,用org.apache.struts2.dispatcher.FilterDispatcher,
否则,用org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter。
从Struts2.1.3开始,将废弃ActionContextCleanUp过滤器,而在StrutsPrepareAndExecuteFilter过滤器中包含相应的功能。
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>-->
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
config
还报错了
The word 'config' is not correctly spelled 展开
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
<init-param>
<param-name>config</param-name>
<param-value>
struts-default.xml,
struts-plugin.xml,
/WEB-INF/struts.xml
</param-value>
</init-param>
<!--
如果是2.1.3之前的版本,用org.apache.struts2.dispatcher.FilterDispatcher,
否则,用org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter。
从Struts2.1.3开始,将废弃ActionContextCleanUp过滤器,而在StrutsPrepareAndExecuteFilter过滤器中包含相应的功能。
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>-->
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
config
还报错了
The word 'config' is not correctly spelled 展开
展开全部
你可以放在Web-inf目录下,如不过在在web.xml中修改一下配置:
举例说明:(假设struts.xml在目录:web-inf/struts/struts.xml)
<!-- struts 2 配置,非默认模式下,加载struts.xml -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>config</param-name>
<param-value>
struts-default.xml,
struts-plugin.xml,
../struts/struts.xml
</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
举例说明:(假设struts.xml在目录:web-inf/struts/struts.xml)
<!-- struts 2 配置,非默认模式下,加载struts.xml -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>config</param-name>
<param-value>
struts-default.xml,
struts-plugin.xml,
../struts/struts.xml
</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询