Learn struts (3)-configure struts applications

Source: Internet
Author: User

Configure the Web. xml file:

1. No matter how many sub-applications are included in the application, you only need to configure an actionservlet. Configuring multiple actionservlet classes to process different functions in an application is not necessary because the servlet itself supports multithreading. In addition, the current Struts framework allows only one actionservlet to be configured in the application.

2. Configure the welcome file list. I can see that I am thinking about it. Why should I have multiple welcome pages? How do I call these multiple pages? It turns out to be like this: The element can contain multiple Sub-element. The call starts from the first specified file in the photo. If the file exists, the file will be returned to the customer. If the file does not exist, search for the file on the next welcome page in sequence, until it is found; if all files do not exist, the server returns the error message "HTTP 404 Not Found" to the client.

3. In Servlet ing cannot be configured in the element, so the struts action cannot be used as the welcome file directly. However, you can configure a Global Forwarding item.

Configure multiple application modules:

1. Create a separate struts configuration file for each sub-application;

2. Configure actionservlet in Web. xmlCodeTo add information for each sub-application;

3. Use Element or switchaction class to switch between sub-applications.

Switch between multiple 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 default module:

Http: // localhost: 8080/tomodule. do? Prefix = & page =/index. Do

This application has not been used yet, but it can be seen in books that it can improve development efficiency.

And better management of projects, can be developed in parallel, but do not know how to solve some intersections

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.