原因:是因为该方法不是静态方法,无法访问静态资源
@RequestMapping("/level1/{id}")
public String level1(@PathVariable("id") int id) {
return "views/level1/"+id;
解决:加上静态修饰符 static
@RequestMapping("/level1/{id}")
public static String level1(@PathVariable("id") int id) {
return "views/level1/"+id;