学生控制器
@GetMapping("/numberStudent")
@ResponseBody
public String getStudentNumber(){
String repot = null;
repot = studentRepository.StudentsNBR();
return repot;
}
Studeent存储库
@Query("select count(e) from Student ")
public String StudentsNBR();
所以基本上我想用bootstrap在卡片上显示学生的号码
<div class="col-sm">
<div class="card bg-light" style="width: 18rem;">
<img class="card-img-top" src="https://cdn.discordapp.com/attachments/557595531526799390/1033961333584052224/spring.gif"
style="height: 180px;">
<div class="card-body">
<div class="p-1 mb-2 bg-dark text-white">
<h5 class="card-title" align="center">Spring BOOT</h5></div>
<script>
jQuery(function($) {$.number( 1234.5678, 2 );
$.ajax({
type : "GET",
url : "/numberStudent"});
</script>
</div>
</div>
</div>
1条答案
按热度按时间inb24sb21#
只需添加模型接口并创建一个保存返回值的变量,
然后转到视图并将其命名为
[th:text=${"variable-name"}]