实体类:
private Date cDateTime;
private String cNickname;
public Date getcDateTime() {
return cDateTime;
}
public void setcDateTime(Date cDateTime) {
this.cDateTime = cDateTime;
}
public String getcNickname() {
return cNickname;
}
public void setcNickname(String cNickname) {
this.cNickname = cNickname;
}
在控制层(controller)手动设置:
HttpServletRequest request = ServletActionContext.getRequest();
String cNickname = request.getParameter("cNickname");
comment.setcNickname(cNickname);
comment.setcDateTime(new Date());