thymeleaf简单语法
参考博客: https://www.cnblogs.com/msi-chen/p/10974009.html
参考博客:https://segmentfault.com/a/1190000017563310#item-1-9
js的请求:https://blog.csdn.net/weixin_33734785/article/details/92405678
<!-- 评论编辑区-->
<div class="ui form">
<div class="field">
<textarea id="content" name="content" placeholder="请输入评论信息..."></textarea>
</div>
<div class="fields">
<div class="field m-margin-bottom-small m-mobile-wide">
<button class="ui teal button m-mobile-wide" id="submitContent"><i class="edit icon"></i>发布</button>
</div>
</div>
</div>
<!-- 评论编辑区-->
<script>
$('#submitContent').click(function () {
var uid = [[${uid}]];
var content = $('#content').val();
var data = {
"uid": uid,
"content": content
};
console.log(content)
$.ajax({
url : "http://localhost:8080/comment",
type : "POST",
headers:{"Content-Type":"application/json;charset=UTF-8"},
data: JSON.stringify(data),
success : function(data){
alert("评论完成!");
},
error : function(data){
alert("评论失败!");
},
finally: function (data) {
alert("是否提交!")
}
})
})
</script>
@RequestMapping(value = "/comment", method = RequestMethod.POST)
public String comment(@RequestBody Abc abc, Model model) {
UserBlogCommentInfo userBlogCommentInfo = userService.selectUserInfoByUid(abc.getUid());
System.out.println(userBlogCommentInfo.getAvatar());
System.out.println(userBlogCommentInfo.getUserName());
System.out.println(abc.getContent());
return "blog";
}
来源:CSDN
作者:大树上的蜗牛
链接:https://blog.csdn.net/qq_42977003/article/details/104844666