拦截器后处理中Struts 2动作变量的修改值未持续 [英] modified values for Struts 2 action variable in interceptor post processing not sustained

查看:90
本文介绍了拦截器后处理中Struts 2动作变量的修改值未持续的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在执行操作之前格式化一些变量,并在执行操作之后但在渲染之前重新格式化.我添加了一个拦截器.我在调用方法调用之前格式化操作变量值,并在调用方法调用之后重新格式化.在拦截器中的invoke方法之前所做的更改在Action execute方法中有效.但是,在呈现页面时,将看不到执行了invoke方法之后对动作变量进行重新格式化的更改.框架是否不接受拦截器的后处理部分中Action变量中所做的更改?请帮忙.

I have a requirement for formatting some variables before going to action and reformat after action executed but before rendering. I added a interceptor. I format the action variable value before invoke method called and reformat after invoke method called. Changes made before invoke method in interceptor are effective in Action execute method. But the changes made for reformat on action variables after invoke method executed are not seen when the page rendered. Will the framework not take the changes done in Action variables in interceptor's post processing section? Please help.

推荐答案

invoke将控制权交还给拦截器时,结果已经呈现出来.

By the time invoke returns control to the interceptor the result has been rendered.

您需要实现PreResultListener,如大黄色书面拦截器"文档页面上的框.

这篇关于拦截器后处理中Struts 2动作变量的修改值未持续的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆