springmvc工程welcome-file-list不起作用的解决方案

springmvc工程welcome-file-list不起作用的解决方案

方法一: controller requestMapping(“/“)

package com.lcg.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class IndexController {

@RequestMapping("/")
public String index(){
    return "redirect:wx/index";
}

}

方法二:修改springmvc-servlet.xml

加上

<!\-\- 使welcome-file-list生效 -->

mvc:default-servlet-handler/

然后web.xml中的

<welcome-file-list>

index.jsp

就可以生效了。

0%