How to customize the Struts Json Plugin Date format for a global scope
As for the title. I don't want to add an annotation(@Json(format="yyyy-MM-dd HH:mm:ss") on every getXXXDate(),can anybody gi开发者_开发百科ve a solution?
You can use struts 2 json plugins in object class, for example:
private Date createdDate;
@JSON(format="MM/dd/yyyy")
// or @JSON(format="date.format") from bundle resource properties files
public Date getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
精彩评论