struts2 拦截器,拦截器后参数丢失

<interceptors>
 <interceptor name="xkzpage" class=""></interceptor>
 <interceptor-stack name="EncodeStack">
 <interceptor-ref name="xkzpage"></interceptor-ref>
 <!--struts-default中,默认的拦截器引用是defaultstack,这个拦截器包传说是经过精心设计的。。所以会把所有的参数注入-->
 <interceptor-ref name="defaultStack"></interceptor-ref>
 </interceptor-stack>
 </interceptors>
 <default-interceptor-ref name="EncodeStack"/> 

 

 

public class XkzPageInterceptor  extends AbstractInterceptor {
 @Autowired
    private XkjsService xkjsService;
 /**
  *
  */
 private static final long serialVersionUID = 1563787957724243266L;


 @Override
 public String intercept(ActionInvocation action) throws Exception {
  String namesapce=action.getProxy().getNamespace();
  if ("/xk".equals(namesapce)) {
   SessionMap  session= (SessionMap) action.getInvocationContext().getSession();
   Map params=action.getInvocationContext().getParameters();
   if (session.get("xkmap")==null) {
    String[] xknums=(String[]) params.get("xknum");
    String xknum=xknums[0];
    if (xknum!=null&&!"".equals(xknum)) {
      List xks= xkjsService.queryXk(xknum,0);
            if (xks!=null&&xks.size()>0)
            {
             session.put("xkmap", xks.get(0));
            }
           
    }
   }
  }
  action.invoke();
  return null;
 }

}

你可能感兴趣的:(struts2)