struts2里面struts.xml如何拆多个文件

okb3ay 2013-03-27 04:59:13
struts.xml 放在src里面,我想把它统一放在WEB-INF/config/模块名里面
如果有哪位高手知道可以麻烦教下吗?
...全文
405 23 打赏 收藏 转发到动态 举报
写回复
用AI写文章
23 条回复
切换为时间正序
请发表友善的回复…
发表回复
okb3ay 2013-04-07
  • 打赏
  • 举报
回复
我晕死了 我终于知道自己是错在哪里了 <package name="test" namespace="/" extends="struts-default"> name我没改名字还是写default 所以错了
okb3ay 2013-04-02
  • 打赏
  • 举报
回复
只用一个就没问题 <include file="member.xml"></include>
okb3ay 2013-04-02
  • 打赏
  • 举报
回复
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts> <include file="member.xml"></include> <include file="test.xml"></include> </struts> struts.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts> <package name="default" namespace="/" extends="struts-default"> <action name="show" class="ShowAction"> <result>/ok.jsp</result> </action> </package> </struts> member.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts> <package name="default" namespace="/" extends="struts-default"> <action name="test" class="TestAction"> <result>/no.jsp</result> </action> </package> </struts> test.xml 这样写噢 有错吗? 怎么老是报错
wyx100 2013-03-29
  • 打赏
  • 举报
回复
#1 得分:0 回复于: 2013-03-27 17:15:18 如果你放在WEB-INF/config/模块名里面的路径下,你需要在web.xml中对你的xml文件做配置,让前端控制器可以找到它。
funi16 2013-03-29
  • 打赏
  • 举报
回复
include就可以啊,上面都有截图的。不知道是不是你的路径写错了,你可以按住ctrl键,然后鼠标移动到文件的地址上面,文件写的路径和名称正确的话,就会变色,点击后可以跳转到那个页面的。
Snail_Yu 2013-03-28
  • 打赏
  • 举报
回复
include进来就可以了,给你截图看看:
okb3ay 2013-03-28
  • 打赏
  • 举报
回复
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts> <include file="member.xml"></include> <include file="test.xml"></include> </struts> 不知道为什么我只用一个<include file="member.xml"></include>就没问题 使用多个就报错了
okb3ay 2013-03-28
  • 打赏
  • 举报
回复
引用 2 楼 shixitong 的回复:
http://www.blogjava.net/nokiaguy/archive/2008/04/16/193457.html include进来就可以了
还是不行
okb3ay 2013-03-28
  • 打赏
  • 举报
回复
引用 2 楼 shixitong 的回复:
http://www.blogjava.net/nokiaguy/archive/2008/04/16/193457.html include进来就可以了
我已经这样写了 struts.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts> <include file="member.xml"></include> <package name="default" namespace="/" extends="struts-default"> </package> </struts> member.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts> <package name="default" namespace="/" extends="struts-default"> <action name="show" class="ShowAction"> <result>/ok.jsp</result> </action> </package> </struts>
dw_java08 2013-03-28
  • 打赏
  • 举报
回复
举个例子: <include file="struts-fileUpload.xml"></include>
xianwangkai 2013-03-28
  • 打赏
  • 举报
回复
include就可以!
okb3ay 2013-03-28
  • 打赏
  • 举报
回复
引用 13 楼 wwwwwwwwwwqaz 的回复:
<include file="xxx.xml"></include>就行了
我是这样写的 一个就可以 2个就报错
BoJerry 2013-03-28
  • 打赏
  • 举报
回复
引用 7 楼 dw_java08 的回复:
举个例子: <include file="struts-fileUpload.xml"></include>
+1
Travel light.. 2013-03-28
  • 打赏
  • 举报
回复
11楼就可以
bao0437 2013-03-28
  • 打赏
  • 举报
回复
3楼的可以。
小杰_ 2013-03-28
  • 打赏
  • 举报
回复
<include file="xxx.xml"></include>就行了
okb3ay 2013-03-28
  • 打赏
  • 举报
回复
我也是这样写的
槑党 2013-03-27
  • 打赏
  • 举报
回复
引用 2 楼 shixitong 的回复:
http://www.blogjava.net/nokiaguy/archive/2008/04/16/193457.html include进来就可以了
一个总的xml,里面写上include的各个分配置文件,这样适合项目组里面多人共同开发
lvzg_005 2013-03-27
  • 打赏
  • 举报
回复
引用 1 楼 licip 的回复:
如果你放在WEB-INF/config/模块名里面的路径下,你需要在web.xml中对你的xml文件做配置,让前端控制器可以找到它。
+
李志遠 2013-03-27
  • 打赏
  • 举报
回复
web.xml加个config <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> <init-param> <param-name>config</param-name> <param-value>struts-default.xml,struts-plugin.xml,../config/模块名1/struts1.xml,../config/模块名2/struts2.xml</param-value> </init-param> </filter>
加载更多回复(2)

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧