最初的问题是配置中指定了一个属性,
suffix=".jsp"因此
ViewResolver实现类将添加
.jsp到从你的方法返回的视图名称的末尾。
但是,由于你注释了
InternalResourceViewResolverthen,所以根据其余应用程序配置,可能未注册任何其他
ViewResolver。你可能会发现现在什么都没用。
由于·文件是静态的,不需要
servlet进行处理,因此使用
<mvc:resources/>映射更加高效,简单。这需要Spring 3.0.4+。
例如:
<mvc:resources mapping="/static/**" location="/static/" />
这将通过启动与所有请求
/static/的
webapp/static/目录。
因此,通过把
index.html在
webapp/static/使用
return "static/index.html";从你的方法,spring应该找到视图。



