七段

无论怎样,请让我先感谢一下国家。

BlogJava 首页 新随笔 联系 聚合 管理
  35 Posts :: 2 Stories :: 7 Comments :: 0 Trackbacks
 Introduction:
JSF:  MVC framework as Struts
DWR: java Ajax framework
Json: a data format definition like XML, YAML. We could use DWR or jsonlib to marshal/unmarshal between json and objects.

How to use?
1, when should we use json or not?
do JSF as much as possible;
only when dynamic collection size on page, do Json
2, when should we use DWR json convertor configuration or customize json convertor by java?
page scope update, do Ajax by DWR as much as possible;
otherwise, do JSF action by json convertor (consolidate convertor by jsonlib or dwr?)


DWR convertor VS Jsonlib convertor:
    DWR:
    convertor setting by xml, annotation or java;

    Jsonlib:
    convertor setting by java (only check @Transient), but more professional overall;

Requirement:
1, simple convertion, no VO or DTO:
    PO to json: 1, cycle detect; 2,include/exclude;
    Json to PO: 1, the same js handle; 2, ajax by dwr; jsf by hidden string
2, one PO map into two JSON model for different domains (e.g. bind different convertor by spring to different domain serviceImpl)

Not to do list:
1, do not use duplicated convertors definition in java/xml/annotation
2, do not DTO or VO when convert between json and objects
3, do not parse or transfer useless fields, e.g. use include / exclude configuration instead during convert objects into json; use "delete" during convert json into object
4, do not use json if could use JSF

posted on 2010-01-04 08:58 sevenduan 阅读(1834) 评论(0)  编辑  收藏 所属分类: Java

只有注册用户登录后才能发表评论。


网站导航: