import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class UserController {
@RequestMapping("/")
public String index(Model model) {
return "index";
}
}
html
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>
$(document).ready(function() {
var message = $("#message").text();
alert(message);
});
</script>
</head>
<body>
<h1 id="message">${message}</h1>
</body>
</html>