Application module in Struts1.1 (Application Modules)
A new feature of Struts 1.1 is the concept of the application module. The application module allows a single Struts application into several modules, each module has its own struts profile, JSP page, Action, and more. This new feature is to solve the largest problem of large and medium-sized development teams, that is, to better support parallel development to allow multiple configuration files instead of a single profile.
In large project development with Struts, use this new feature will be a very good choice.
Below I show this feature with a very simple example.
Usually, the most common directory structure of the file is as follows: test /..../ Web-INF /............./ Classes ......... . ../ lib ........... / *. TLD ........... / struts-config.xml ........... / web. XML ........... /Validator-rules.xml ........... /VALIDATION.XML ........... ... ./js...jsp (a simple JSP page for this example) .... / *. jsp .... If we add a separate module such as: Test1, the most common directory structure of the file is as follows: TEST /.../ Test1 **** ......... / main11.jsp (a simple JSP page for this example) .. ....... / *. jsp **** .... / Web-inf /........./ Classes ........... / lib ........... / *. TLD ........... / struts-config.xml ........... / Struts-test1-config. XML ***** ........... /Web.xml ........... /VALIDATOR-Rules.xml ........... Validation.xml ........... ... / js ... / css ... / main1.jsp (a simple JSP page for this example) ... / * .jsp ..... [**** "is newly added for new files or directories] The following XML configuration files are changed: 1.Struts-config.xml in the original action-mapping Increase SwitchAction such as: .... ....
Note: If you want to use the call of the module, prefix = empty string
Good way to give the module conversion below
Start Tomcathttp: // localhost: 8080 / test / switchdo.do? Prefix = / test1 & page = / login3.do calls Struts-Test1-Config.xml under /login3.dohttp://localhost:8080/test/switchdo. Do? prefix = & page = / login1.do calls Struts-Config under Struts-Config.xml, then calls Struts-Config. Under XML / Login.do, in general, the transition between modules is to be used to use org.apache.struts.Actions.Switch, and it needs to pass two parameters (generally error-in) Please note)
[Note: There is already a configuration file in the formal version of Struts1.1, 2003-07-21]
This post was originally posted in the Struts area in CJW (http://www.chinajavaworld.net)
JPLATEAU 2003-05-05