package com.xxx.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class IndexController {
@GetMapping("/")
public String showIndexPage(){
return "index";
}
}
IndexController.java
<!DOCTYPE html>
<html xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
xmlns:th="http://www.springframework.org/schema/data/jaxb" xmlns:layout="http://www.w3.org/1999/xhtml">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<link rel="stylesheet" th:href="@{/bower_components/bootstrap/dist/css/styles.less}"
href="../../bower_components/bootstrap/dist/css/styles.css"/>
<script th:src="@{/bower_components/less/dist/less.min.js}"
src="../../bower_components/less/dist/less.min.js"></script>
</head>
<body>
</div>
</div>
<script th:href="@{/bower_components/bootstrap/dist/js/bootstrap.min.js}"
src="../../bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
</div>
</body>
</html>
index.html
JavaScript标记在索引页面上不起作用。我尝试了很多方法,但是找不到解决方案。如果您能帮助我就很高兴
我正在使用Thymeleaf作为模板引擎