Tuesday, March 22, 2011
Struts 1.x – Multiple configuration files.
1. Single module
A single module support multiple Struts configuration files.
In the web.xml, you can separate multiple Struts configure file by a comma “,“.
Test it:
1.http://localhost:8080/StrutsExample/Page1.do
It will display the page1.jsp
2.http://localhost:8080/StrutsExample/common/Welcome.do
It will display the page2.jsp
Both Struts configuration are loaded property.
--------------------------------------------------------
2. Multiple modules
Multiple modules, each has own Struts configuration files.
Both “struts-config-admin.xml” and “struts-config-common.xml” files contains the same settings, Struts is able to differential it via the “config” parameter value in web.xml.
struts-config-admin.xml, struts-config-common.xml
web.xml
Test it
The “config/admin” will match to this URL pattern – http://localhost:8080/StrutsExample/admin/
The “config/common” will match to this URL pattern – http://localhost:8080/StrutsExample/common/
1.http://localhost:8080/StrutsExample/admin/Welcome.do
It will display the admin/welcome.jsp
2.http://localhost:8080/StrutsExample/common/Welcome.do
It will display the common/welcome.jsp
Each modules has own Struts configuration file.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment