Question about Springmvc default homepage, springmvc default homepage

Source: Internet
Author: User

Question about Springmvc default homepage, springmvc default homepage

Springmvc, which was previously written by myself, is a lazy homepage by default:

Default homepage defined in web. xml:

  <welcome-file-list>    <welcome-file>index.html</welcome-file>  </welcome-file-list>  

Then jump to the dynamic link of springmvc in index.html.

So there's a http://www.xxx.com/index/home on the address.

The customer does not want/index/home today. Problem: welcome-file-list generally only supports static Web pages. If you have to configure it as the controller URL of SpringMVC, an error is reported.

After checking the information, the solution is as follows:

The following changes are made in web. xml:

<Welcome-file-list> <welcome-file> index </welcome-file> <! -- The index has no suffix --> </welcome-file-list> <servlet-mapping> <! -- The Servlet name is myproject-dispatcher, which can have multiple dispatcherservlets, which are distinguished by names. Each DispatcherServlet has its own WebApplicationContext context object. Save it to the ServletContext and Request object at the same time --> <servlet-name> myproject-dispatcher </servlet-name> <! -- Intercept the request at the end of *. do. --> <Url-pattern>/</url-pattern> </servlet-mapping> <servlet-name> myproject-dispatcher </servlet-name> <url-pattern>/index </url-pattern> </servlet-mapping>

Note: welcome-file-list is configured with no/index. The SpringMVC controller is registered with A/index URL (this includes "/").

 

Java enterprise-level general permission security framework source code SpringMVC mybatis or hibernate + ehcache shiro druid bootstrap HTML5

 

[Download java framework source code]

 

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.