报错代码:2019-12-26 15:45:08.541 ERROR 13316 --- [nio-8080-exec-9] org.thymeleaf.TemplateEngine : [THYMELEAF][http-nio-8080-exec-9] Exception processing template "admin_index": An error happened during template parsing (template: "class path resource [templates/admin_index.html]")
org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/admin_index.html]")
Controller类是这样的
@Controller
@RequestMapping("/admin")
public class LoginController {
@Autowired
private UserService userService;
@GetMapping
public String loginPage() {
return "admin/login";
}
@PostMapping("/login")
public String login(@RequestParam String username,
@RequestParam String password,
HttpSession session,
RedirectAttributes attributes) {
User user = userService.checkUser(username, password);
if (username == "admin"&&password == "111111") {
return "admin_index";
} else {
attributes.addFlashAttribute("message", "用户名和密码错误");
return "admin_index";
}
}
//为了方便跳转页面设置账号密码无论对错都跳转到admin_index
}
admin_index.html头文件
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org">
<head th:replace="admin/_fragments :: head(~{::title})">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>博客管理</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
<link rel="stylesheet" href="../../static/css/me.css">
</head>
<body>
输入账号密码无论对错直接跳500,CSDN上搜到的方法都试过了都没用