按照网上说的在web.xml中更改
[code="xml"]
config
struts-default.xml,struts-plugin.xml,../resources/struts2/struts.xml
[/code]
不管用,报错找不到action(struts.xml在src目录下能正常访问)
有没有人实际操作过?
struts2.3.1版本怎么更改struts.xml的位置?
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- iteye_5246 2012-08-31 21:53关注
=============web.xml =============
[code="xml"]
<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"><!-- struts2 --> <filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.FilterDispatcher </filter-class> <init-param> <param-name>config</param-name> <param-value>../struts2conf/struts.xml</param-value> </init-param> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <welcome-file-list> <welcome-file>index.wml</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list>
[/code]
===============struts.xml================ 在 struts2conf 目录下
[code="xml"]
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<!-- struts2 默认配置文件,必须加进来 有这里看出,当前文件的路径是跟路径下classes路径,所以其他的文件要从classes这个路径开始找 -->
<!-- 自己添加的配置文件 注意路径 -->
[/code]本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报