JavaScud | Forum | JIRA | Blog |
  Dashboard > WebWork2文档中文化计划 > ... > Interceptors > Alias Interceptor
  WebWork2文档中文化计划 Log In View a printable version of the current page.  
  Alias Interceptor
Added by 黑灵, last edited by scud on May 19, 2006  (view change)
Labels: 
(None)

这个拦截器的目的是将一个参数名映射为另一个参数名.它可以作为在不同action之间共享不同名字的相同参数的粘合剂,这一点对于实现action链很有用.

Action的别名表达式应该是这样的形式:

 #{ "name1" : "alias1", "name2" : "alias2" }
. 这个意思是说,如果一个action(或者stack中的其他东西)有一个叫name1的属性,这个action应用了这个拦截器,且有alias1的setter方法, name1的值会被设置到 alias1上.

参数

  • aliasesKey (可选的) - action中的别名Map的名字 (默认为aliases).

扩展这个拦截器

这个拦截器没有可扩展的地方.

例子

<action name="someAction" class="com.examples.SomeAction">
  <\!-\- The value for the foo parameter will be applied as if it were named bar \-->
  <param name="aliases">#{ 'foo' : 'bar' } </param>
  <\!-\- note: the alias interceptor is included with the defaultStack in webwork-default.xml \-->
  <interceptor-ref name="alias"/>
  <interceptor-ref name="basicStack"/>
  <result name="success">good_result.ftl</result>
</action>
Site running on a free Atlassian Confluence Open Source Project License granted to WebWork China. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.3 Build:#808 May 29, 2007) - Bug/feature request - Contact Administrators