resource下的HTML页面怎么访问,Spring MVC:无法通过InternalResourceViewResolver访问HTML页面...

我有两个文件index.html和user.jsp,那里的位置是WebContent/WEB-INF /。Spring MVC:无法通过InternalResourceViewResolver访问HTML页面

此外,我能够用下面的代码来访问user.jsp:

class="org.springframework.web.servlet.view.InternalResourceViewResolver">

控制器代码:

然而,我无法用下面的访问的index.html修补代码:

class="org.springframework.web.servlet.view.InternalResourceViewResolver">

控制器代码: 个

@RequestMapping(value="/usertimepass",method=RequestMethod.GET)

@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)

public ModelAndView time(){

ModelAndView mv=new ModelAndView();

mv.setViewName("index");

System.out.println("returned index");

return mv;

}

的web.xml

xmlns="http://java.sun.com/xml/ns/javaee"

xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"

id="WebApp_ID" version="3.0">

SampleApp

dispatcher

org.springframework.web.servlet.DispatcherServlet

2

dispatcher

/

contextConfigLocation

/WEB-INF/applicationContext.xml

org.springframework.web.context.ContextLoaderListener

谢谢!

+0

你能告诉我的完整路径您正在使用的ModelAndView类的完整包名称? –

+0

我没有得到你。您使用的是以下类: –

+0

: import org.springframework.web.servlet.ModelAndView; –