Posted on 2005-10-08 15:40
BlueO2 阅读(515)
评论(0) 编辑 收藏 所属分类:
MVC Framework
也算是Struts in Action的读书笔记吧~~~
1 实现业务层接口
public class ArticleForm extends ActionForm implements ArticleBean{
//...
}
调用ArticleBean articleBean = (ArticleBean)form;
articleModel.update(articleBean.getKey(),articleBean);
2 手动初始化
ArticleForm aForm = (ArticleForm)form;
ArticleBean aBean = new ArticleBean(aFrom.getxxxx..,.,.,.);
4 提供工厂方法
ActionForm中封装此方法
public ArticleBean getArticleBean(){
ArticleBean aBean = new ArticleBean(
this.getXXXX,
this.getXXXX,
......
)
}
5 传递Map对象
用BeanUtils包或者手动产生于ActionForm
public Map describe(){
map = new HashMap();
map.add("xx",this.getXXX());
map.add("xx",this.getXX());
//......
}
6 反射传递数据
写于action
BeanUtils.copyProperties(myBusinessBean,myActionForm);
//Business Object's somemethod
BeanUtils.copyProperties(myActionForm,myBusinessBean);