m0_38064244
m0_38064244
2017-09-21 07:53

springMvc restful 404

  • spring
  • url

视图解析器配置
@Bean
public ViewResolver viewResolver(){
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
viewResolver.setPrefix("WEB-INF/views/");
viewResolver.setSuffix(".jsp");
viewResolver.setExposeContextBeansAsAttributes(true);
return viewResolver;
}

请求
@RequestMapping("/spitter/{username}")
public String profile(@PathVariable("username") String username,Model model){
    Spitter spitter = spittleRepository.findByUsername(username);
    model.addAttribute("spitter", spitter);
    return "profile";
}

报错404
HTTP Status 404 - /SP/spitter/WEB-INF/views/profile.jsp
SP为工程名  为什么WEB-INF前会有个spitter
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐

换一换