Learn struts (3) - Configuring Struts Applications

xiaoxiao2021-03-06  100

Configure the web.xml file:

1. You only need to configure an ACTIONServlet regardless of how much subscriber included in your application. Configuring a plurality of ActionServlet classes to handle different features in applications, it is not necessary because servlet itself supports multithreading. Moreover, the current Struts framework is only allowed to configure an ActionServlet in the application.

2. Configure Welcome File List, see here, why do you want multiple welcome pages? How do this multiple pages call? It turned out to be like this: element can contain multiple sub-elements, call from the first specified file of the narrative, if this file exists, will return this file to the customer; if This file does not exist, follow the files of the next welcome page until it is found; if all files do not exist, the server returns the error message of "HTTP 404 Not Found" to the client.

3. You cannot configure the servlet mapping in the element, so you cannot directly use the Struts's action as a welcome file. However, it can be implemented by configuring a global forwarding item.

Configure multiple application modules:

1. Create a separate Struts profile for each sub-app;

2. Add each sub-application information in the configuration code of the web.xml ActionServlet;

3. Use the element or the SwitchCHAction class to achieve switching between sub-applications.

Switch between multiple sub-application modules:

For example, switch from the default module to moduleb:

Http: // localhost: 8080 / tomodule.do? prefix = / moduleb & page = / index.do

Switch from Moduleb to the default module:

HTTP: // localhost: 8080 / Tomodule.do? prefix = & page = / index.do

转载请注明原文地址:https://www.9cbs.com/read-100344.html

New Post(0)