ChainingInterceptor

本文介绍了如何使用基本堆栈拦截器将值栈中对象的属性复制到当前正在执行的对象,同时提供了参数控制、示例代码及应用场景。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

An interceptor that copies all the properties of every object in the value stack to the currently executing object, except for any object that implementsUnchainable. A collection of optional includes and excludes may be provided to control how and which parameters are copied. Only includes or excludes may be specified. Specifying both results in undefined behavior. See the javadocs for OgnlUtil.copy(Object, Object, java.util.Map, java.util.Collection, java.util.Collection) for more information.

It is important to remember that this interceptor does nothing if there are no objects already on the stack. This means two things: One, you can safely apply it to all your actions without any worry of adverse affects. Two, it is up to you to ensure an object exists in the stack prior to invoking this action. The most typical way this is done is through the use of the chain result type, which combines with this interceptor to make up the action chaining feature.

Interceptor parameters:

  • excludes (optional) - the list of parameter names to exclude from copying (all others will be included).
  • includes (optional) - the list of parameter names to include when copying (all others will be excluded).

Extending the interceptor:

There are no known extension points to this interceptor.

Example code:

 
 
 <action name="someAction" class="com.examples.SomeAction">
     <interceptor-ref name="basicStack"/>
     <result name="success" type="chain">otherAction</result>
 </action>

 <action name="otherAction" class="com.examples.OtherAction">
     <interceptor-ref name="chain"/>
     <interceptor-ref name="basicStack"/>
     <result name="success">good_result.ftl</result>
 </action>
 
该迭代器的作用是把value stack里面对象的属性拷贝到自己的action
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值