watermud
watermud
2010-07-31 23:24

Interceptor中ValueStack设值的问题

  • struts

Interceptor,invocation.invoke();之前设值是有效的,之后却失效了,代码如下:
[code="java"]
@Override
public String intercept(ActionInvocation invocation) throws Exception {
ActionContext context = ActionContext.getContext();
ValueStack vs = context.getValueStack();
vs.set("dddd", "ddddddddddd");

    String result = invocation.invoke();

    System.out.println("$$$$$$$$$$"+vs.findString("dddd"));
    vs.set("dddd", "ffffffffffff");
    System.out.println("$$$$$$$$$$"+vs.findString("dddd"));

}

[/code]

console输出结果是对的:
$$$$$$$$$$ddddddddddd
$$$$$$$$$$ffffffffffff

jsp显示是错的:
--> ddddddddddd
谁见过这个问题?
(Interceptor是定义在最下面的,最接近action了)

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答