struts 拦截器 初始化参数问题
拦截器:
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
public class TestInterceptor implements Interceptor{
private String hello;
public void setHello(String hello) {
this.hello = hello;
}
public String intercept(ActionInvocation arg0) throws Exception {
System.out.print("hello:" + this.hello);
return arg0.invoke();
}
public void init() {
}
public void destroy() {
}
}
配置文件:
<interceptors>
<interceptor name="testInterceptor" class="com.xxx.interceptor.TestInterceptor">
<param name="hello">world</param>
</interceptor>
</interceptors>
<!-- 转向 -->
<action name="next" class="com.xxx.common.action.NextAction">
<!-- 定义逻辑视图和物理资源之间的映射 -->
<result name="success">${address}</result>
<interceptor-ref name="testInterceptor">
<param name="hello">world</param>
</interceptor-ref>
<interceptor-ref name="myDefaultStack"/>
</action>
怎么这个hello打死都传不过去呢,有什么没考虑到么?求大家指点。。
hello:null