
Generally, all the applications and systems are modularized so that the time of development and complexity can be reduced. The struts also give the flexibility to have more than one independent modules in the application. The separate struts-config files are introduced for each module. This helps developers to develop the complex applications more effectively as different independent applications can be developed separately and then combined together to make a complete system. The struts gives a special Action class, SwitchAction , which is used for the switching between the modules. The below example will demonstrate the modules in the Struts Applications.
The following things needs to be changed to make more than one modules in the application.
- All the module specific config files should be kept on the module specific directories under WEB-INF folder.
- All the jsp files for the module should be kept under the module folder.
- All the module specific files should be passed in the ActionServlet in the Web.xml file.
There are three approaches for switching from one module to another.
- You can use the org.apache.struts.actions.SwitchAction from the Extras JAR,
- you can use a <forward> (global or local) and specify the contextRelative attribute with a value of true,
- or you can specify the "module" parameter as part of any of the Struts JSP hyperlink tags (Include, Img, Link, Rewrite, or Forward).
Note:- The coming example will demonstrate the all three approaches for the application
Jsp Discussion
- - Two forms in one JSP
- - PASS VARIABLES BETWEEN 2
- - Table data
- - Unable to laod the image
- - The Ultimate Web UI Frame




