"Welcome-file-list" makes the default page effective

Source: Internet
Author: User

<welcome-file-list>
<welcome-file>404.html</welcome-file>
<welcome-file>/view/index.jsp</welcome-file>
</welcome-file-list>

Workaround:

1. spring.3.0.4 later versions are available <mvc:resources/> (recommended in this way)

A) First, <mvc:resources/> allows static resources to be placed anywhere, such as the Web-inf directory, under the Classpath, and you can even hit a static file such as JavaScript into the jar package. The Location property specifies the position of the static resource, because the Site property is a resource type, so you can specify the resource location by using a resources prefix such as "classpath:".         The static resources of a traditional web container can only be placed under the root path of the Web container, and <mvc:resources/> completely breaks the limit. b) Secondly, <mvc:resources/> optimizes static resources based on the current well-known browser optimization principles of page speed and YSlow. You can use the Cacheseconds property to specify the cache time for a static resource on the browser side, which can typically be set to one year to take advantage of browser-side caching.         When you output a static resource, the expires and Cache-control values of the message headers are configured to respond to the configuration. When a request for a static resource is received, the last-modified value of the request header is checked, and if the static resource does not change, the corresponding status code is returned directly, prompting the client to use the data cached by the browser rather than outputting the contents of the static resource to the client to fully conserve bandwidth. Improve program performance. In Spring-servlet.xml, add the following configuration:
<mvc:resources location= "/image/" mapping= "/image/**"/>
Or:
<mvc:resources location= "/,classpath:/meta-inf/image/" mapping= "/image/**"/>
The above configuration maps the/meta-inf/image/directory under the Web root path "/" and the Classpath to the/image path. Suppose the Web root path has images, JS these two resources directory, under images there are bg.gif pictures, under JS test.js file, you can/images/1.jpg this static resources.

"Welcome-file-list" makes the default page effective

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.