开发者

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;
        }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜