日期:2014-05-17 浏览次数:20754 次
<interceptors> <!-- 定义结果转发拦截器 --> <interceptor name="opResult" class="util.web.OpResultInterceptor"> </interceptor> <!-- 定义默认拦截器 --> </interceptors> <default-interceptor-ref name="opResult" />
@Override public String intercept(final ActionInvocation arg0) throws Exception { final String methodName = arg0.getProxy().getMethod(); final Class actionClass = arg0.getAction().getClass(); System.out.println(methodName); final Method method = actionClass.getMethod(methodName); [del]if (method.getAnnotation(OpResultToResultPage.class) != null) { // System.out.println("in"); final OpResultBean opResultBean = new OpResultBean(); final HttpServletRequest request = (HttpServletRequest) arg0 .getInvocationContext().get(StrutsStatics.HTTP_REQUEST); final String Page1 = request.getHeader("Referer"); opResultBean.setReferer(Page1); LocaleThreadTool.set("opResult", opResultBean); final String actionResultString = arg0.invoke(); if (ObjectUtils.isEmpty(opResultBean.getResult())) { opResultBean.setResult(actionResultString); } return "result"; }[/del] return arg0.invoke(); }