【发布时间】:2021-09-16 02:25:45
【问题描述】:
这是我的控制器:
@RestController
public class GraphController {
@GetMapping("/displayBarGraph")
public String barGraph(Model model) {
Map<String, Integer> surveyMap = new LinkedHashMap<>();
surveyMap.put("Java", 40);
surveyMap.put("Dev oops", 25);
surveyMap.put("Python", 20);
surveyMap.put(".Net", 15);
model.addAttribute("surveyMap", surveyMap);
return "barGraph";
}
@GetMapping("/displayPieChart")
public String pieChart(Model model) {
model.addAttribute("pass", 50);
model.addAttribute("fail", 50);
return "pieChart";
}
这是我的file.proprieties:
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.enabled=false
spring.mvc.view.prefix=/WEB-INF/views/
spring.mvc.view.suffix=.html
这些是我的 HTML 文件:
但它总是像这样重定向我:
请问有什么解决办法吗?
【问题讨论】:
标签: java spring spring-boot spring-mvc thymeleaf