Struts2的scope interceptor

这个interceptor的参数我有点混,session指要传递的 action中的属性的话,那key是做什么用的呢。。。是可以通过session.get(key)这样取值的么。

比如说你在session指定了要传递action中的abc属性,给key指定了abcdefg这个值,struts取值时就会以abcdefg.abc为key去取value(这么个意思,但具体实现不一定是这样)

key不设置,默认值就是action的class,这样当有两个action都往session中传了abc属性时,不会混淆

这里设置的key是用来作key的前缀的,一般不需要设置(两个key不一样,有点绕口)

看官方文档: [url=http://struts.apache.org/2.0.14/docs/scope-interceptor.html]Scope Interceptor[/url]

key - a session/application attribute key prefix, can contain following values:

* CLASS - that creates a unique key prefix based on action namespace and action class, it's a default value

* ACTION - creates a unique key prefix based on action namespace and action name

* any other value is taken literally as key prefix