Struts 2中的Web片段项目设置 [英] Web Fragment project setting in Struts 2

查看:66
本文介绍了Struts 2中的Web片段项目设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Struts 2进行J2EE项目.我将通过Web片段项目划分不同的模块.

I am working on J2EE project with Struts 2. I am going to divide different module through web fragment project.

在我的核心模块中,我使用的是Struts2,它运行良好.现在,我还希望我的片段模块使用Struts2.那么将所有映射放在核心模块的struts.xml中是一种好习惯吗?是否可以将struts.xml分为几部分并放置在不同的片段模块中?

In my core module I am using Struts2 and it works well. Now I also want my fragment module to use Struts2. So is it a good practice to place all the mapping in struts.xml of core module? Is it possible to divide the struts.xml into pieces and place in different fragment module?

如果可以将struts.xml放置在片段模块中,应该将其放置在哪个文件夹中?

If I can place struts.xml in fragment module, which folder should I place it ?

推荐答案

所有模块开发都是通过名称空间的概念完成的.您可以在不同的名称空间下创建不同的模块.要分隔模块配置文件,应使用include标记.将模块配置放入相应的文件中,并将其放在struts.xml:

All module development are done with the concept of namespaces. You could create different modules under different namespaces. To separate the modules configuration files you should use include tag. Place the module config into the corresponding file and put it in the struts.xml:

<include file="struts-module1.xml"/>
<include file="struts-module2.xml"/>
...

如果您需要了解struts2中的名称空间,请查看 Struts 2命名空间配置示例和说明.

If you need the understanding the namespaces in the struts2 then look at Struts 2 Namespace configuration example and explanation.

这篇关于Struts 2中的Web片段项目设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆