WebWork中实现IoC(4)
来源:互联网 发布:知乎日报 最佳吐槽 编辑:程序博客网 时间:2024/06/03 18:05
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
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,都会被传递组件实例
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- 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的实现
- 关于《网页中使用天堂免费计数器》的问题
- iBATIS中文开发指南1.2.9版
- java传递是引用的拷贝,既不是引用本身,更不是对象
- 今天开始学Eclipse/SWT(1)
- 在WebWork中实现IoC(2)
- WebWork中实现IoC(4)
- WebWork中实现IoC(5) (完)
- 开发基于J2EE,Struts和SQL Server的测试管理软件,诚
- Java行业的圣经-四本最重要的个人藏书
- 在Eclipse中使用JUnit(翻译)
- 用Java访问SQL Server 2000数据库
- Java+Oracle应用开发的几个经典问题
- Struts 框架之构建 Model组件
- Struts框架之构建Controller组件