modified values for Struts 2 action variable in interceptor post processing not sustained

邮差的信 提交于 2020-01-05 10:18:14

问题


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.


回答1:


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

You need to implement a PreResultListener as described in the big yellow box on the "Writing Interceptors" doc page.



来源:https://stackoverflow.com/questions/14697623/modified-values-for-struts-2-action-variable-in-interceptor-post-processing-not

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!