启动我的应用时:http://localhost:9000/index 我得到了圆形视图路径[index]:将再次发送回当前处理程序URL [/ index]。
这是我的控制器:
@Controller
@RequestMapping("/index")
public class UserController {
@RequestMapping(value="", method= RequestMethod.GET)
public ModelAndView findAllUsers() {
ModelAndView model = new ModelAndView("index");
List<User> usersList = new ArrayList<>();
try {
usersList = (List<User>) userDao.findAll();
}
catch (Exception ex){
log.severe("Eroor in retrieving users list");
}
model.addObject("usersList");
return model;
}
我有一个属性文件,其中我声明了这样的视图解析器:
spring.view.prefix: /WEB-INF/jsp/
spring.view.suffix: .jsp
在我的pom中我添加了这种依赖:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
答案 0 :(得分:0)
对于那些对答案感兴趣的人,我通过修改解析器视图的属性文件来解决它,如下所示:
spring.mvc.view.prefix = /WEB-INF/jsp/
spring.mvc.view.suffix = .jsp