WebWork中实现IoC(4)
来源:互联网 发布:大数据分析引擎chart 编辑:程序博客网 时间:2024/05/22 13:51
4、在WebWork和XWork中配置组件
(1)配置web.xml
要配置WebWork的组件管理,需要在web.xml中加入下面各行:
<filter>
<filter-name>container</filter-name>
<filter-class>com.opensymphony.webwork.lifecycle.RequestLifecycleFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>container</filter-name>
<url-pattern>*.action</url-pattern> <!-- modify appropriately -->
</filter-mapping>
<listener>
<listener-class>com.opensymphony.webwork.lifecycle.SessionLifecycleListener</listener-class>
</listener>
<listener>
<listener-class>com.opensymphony.webwork.lifecycle.ApplicationLifecycleListener</listener-class>
</listener>
<interceptor name="component"
class="com.opensymphony.xwork.interceptor.component.ComponentInterceptor"/>
<components>
<component>
<scope>session</scope>
<class>com.opensymphony.webwork.example.counter.Counter</class>
<enabler>com.opensymphony.webwork.example.counter.CounterAware</enabler>
</component>
</components>
每个component有三个属性:
l scope:组件生命周期范围,有效值为applaction、session和request
l class:组件类全路经
l enabler:enabler类或接口(后者推荐使用),任何作为enabler实例的Action,都会被传递组件实例
- WebWork中实现IoC(4)
- WebWork中实现IoC(4)
- 在WebWork中实现IoC(1)
- 在WebWork中实现IoC(2)
- 在WebWork中实现IoC(3)
- WebWork中实现IoC(5) (完)
- 在WebWork中实现IoC(2)
- WebWork中实现IoC(5) (完)
- 在WebWork中实现IoC(3)
- 使用Webwork实现IOC
- WebWork IoC 特性使用
- WebWork中的IOC
- 关于webwork的IOC容器
- 使用Webwork 2.2.4实现文件上传
- 使用Webwork 2.2.4实现文件上传
- Spring中IOC的实现
- Spring中IOC的实现
- Spring中IOC的实现
- 在WebWork中实现IoC(2)
- 数学爱好者发现已知最大素数:共七百万位
- Effective STL 条款6 : 当心C++另人迷惑的解析
- 网格计算环境下并行回路自调度法
- 在WebWork中实现IoC(3)
- WebWork中实现IoC(4)
- WebWork中实现IoC(5) (完)
- WebWork2特性
- 在vb中实现鼠标手势
- Java更新XML的四种常用方法简介
- WebWork2教程(中文版)补充-例子源代码下载
- 面向对象的软件测试
- 人類的開始...[爆笑]
- 有趣的sql(1)