1

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

In my core module I am using Struts 2 and it works well. Now I also want my fragment module to use Struts 2.

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?

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

Roman C
  • 49,761
  • 33
  • 66
  • 176

1 Answers1

0

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"/>
...

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

Roman C
  • 49,761
  • 33
  • 66
  • 176