struts配置文件l中使用include 标签 引入另外一个在jar中的struts文件
来源:互联网 发布:和谐网络用语 编辑:程序博客网 时间:2024/05/22 01:35
最近遇到了一个需求:有一个master struts.xml, 该文件中需要引入若该子模块中struts.xml.
但是这些子模块都以jar包的方式放入主模块的classpath中,当然它们的struts.xml也在jar中, 这种情形主模块的struts还能引入吗?
首先问问google,结果是可行, 如下来自struts官方网站:
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"><struts> <include file="Home.xml"/> <include file="Hello.xml"/> <include file="Simple.xml"/> <include file="/util/POJO.xml"/> <include file="/com/initech/admin/admin-struts.xml"/></struts>Each included file must be in the same format as struts.xml, including theDOCTYPE. The include files can be placed anywhere on the classpath and should be referred to by that path by the "file" attribute.
开始尝试:
子模块的struts配置文件 名为test-struts.xml, 路径为com/strutsTest/myTest/
1. 在主struts配置文件中使用include标签,并填入全路径, 如下。
<?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"><struts><include file="struts-default.xml" /><include file="com/strutsTest/myTest/test-struts.xml" /></struts>结果:扑街
2. 在主struts配置文件中使用include标签,只填入文件名, 如下。
<?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"><struts><include file="struts-default.xml" /><include file="test-struts.xml" /></struts>结果:扑街
3. 在主struts配置文件中使用include标签,只填入文件名 并将子模块中的struts配置文件放入jar的顶级路径中, 即:
childModule.jar-com --strutsTest --.....test-struts.xml
主struts配置文件与2相同
<?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"><struts><include file="struts-default.xml" /><include file="test-struts.xml" /></struts>结果: 成功!
可是为什么呢,暂记录,等有时间解释,并期待大牛的答疑。
- struts配置文件l中使用include 标签 引入另外一个在jar中的struts文件
- struts配置文件l中使用include 标签 引入另外一个在jar中的struts文件
- 2013-02-27 复习struts —— 在struts.xml中include 一个xml文件失败
- struts2中struts.properties配置文件详解(及在struts.xml文件中的配置)
- struts 点击jar包中的文件Path must include project and resource name: /struts-default.xml
- Struts-config.xml文件配置文件中的几个标签的顺序
- Struts2_1300_IncludeModules struts.xml中的include标签
- struts-2.5.14.1中jar包引入
- 在STRUTS中如何使用 标签
- 在jsp中使用Struts标签
- struts中配置文件的include思考
- struts中include标签简单应用
- struts 的 include标签
- 在Action中查询出SQL SERVER表的数据,返回一个list。怎么在JSP页面中使用Struts标签,显示出表中的内容?(转)
- struts中tdl文件的引入方式
- struts配置文件标签顺序
- android如何在一个布局文件中包含另外一个布局文件(include属性)
- 在struts配置文件中使用spring配置的bean
- 混合高斯模型mixture Gaussians和EM算法
- android Snapshot
- Linux操作系统下如何制作Image映像文件
- Erlang的模式匹配
- CALayer小记1
- struts配置文件l中使用include 标签 引入另外一个在jar中的struts文件
- 线性回归,logistic回归和一般回归
- MongoDB搭建和简单操作(windows环境)
- 全国青少年信息学奥林匹克竞赛培训---选择排序
- ASP中〈%# 〉与〈%=〉的区别
- AOP在Spring中的配置
- 关于UIWebView的一些事
- 判别模型、生成模型与朴素贝叶斯方法
- Apache优化3