我正在尝试发表评论功能,只有当用户是第一个并且评论也是第一个时它才会显示评论。 如果用户两次发表评论,则第二个评论不会显示在评论列表中。
content_view.jsp
//function to list all the comments
function listReply(){
$.ajax({
type: "get",
url: "reply/list.do?bId=${content_view.bId}",
success: function(result){
$("#listReply").html(result);
}
});
}
ReplyController.java
@RequestMapping("list.do")
public ModelAndView list(@RequestParam int bId, ModelAndView mav){
List<ReplyDto> listReply = replyService.listReply(bId);
mav.setViewName("replyList");
mav.addObject("list", listReply);
return mav;
}
replyList.jsp
<c:forEach var="row" items="${list}">
${row.memId} (${row.regDate})
<br>
${row.rText}
</c:forEach>
replyDto.java
int rId; // reply no
int bId; // board no
String rText; // reply text
String memId;
public int getrId() {
return rId;
}
public void setrId(int rId) {
this.rId = rId;
}
public int getbId() {
return bId;
}
public void setbId(int bId) {
this.bId = bId;
}
...
// toString()
@Override
public String toString() {
return "ReplyDto [rId=" + rId + ", bId=" + bId + ", rText=" + rText
+ ", memId=" + memId + "]";
}
所以当我调试代码时,toString()只执行一次。为什么会这样?