webx学习手册

来源:互联网 发布:linux mkdir -m 编辑:程序博客网 时间:2024/06/07 08:25

http://openwebx.org/docs/index.html

http://blog.csdn.net/godfrey90/article/details/6677320


Webx支持多种注入的方式

  • 一般性注入:Spring支持的注入方式,webx均支持,因为webx完全建立在spring基础上。包括明确定义的注入、@Autowired注入等。
  • 特殊注入:webx对一些短生命周期的对象进行特殊处理,使它们成为singleton长生命周期的对象,从而可被注入到一般的singleton对象中。如request, response, session等。
  • 参数注入:screen/action/control等均为singleton,因而Spring只能对其注入singleton 对象,以及被特殊处理后的request/response/session等对象。 但data-resolver服务使得一些基于request的数据可以参数的方式注入到screen/action/control中。

!DataResolver在Webx3中代表一个数据解析器,从上下文(request,session) 解析出值,注入到响应的参数中。

//传统的写法public void execute(Rundata rundata, Context context) {        String name = rundata.getParameters().getString("name");        context.put("name", name);}
//使用参数注入之后的写法public void execute(@Param("name") String name, Context context) {        context.put("name", name); }

0 0
原创粉丝点击