struts2中action之前执行拦截器的问题
我正在研究struts2。 我有一个拦截器在我的操作类之前执行。 现在,当我在 jsp 页面上提交时,控件将转到拦截器,经过一些处理后,控件将转到操作类。 这个完整的流程运行良好。 但我发现两件事 -
1)控制在进入操作类之前不会进入action-validation.xml。
2)提交前未获取已进入jsp页面的文本字段等的值。
谁能告诉我如何找到这两点的解决方案。
提前致谢。
I am working on struts2. I have an interceptor that executes before my action claas. Now when I submit on a jsp page control goes to interceptor and after some processing there the control goes to action class. This complete flow is running well. But I found two things –
1) Control does not go to action-validation.xml before going to action class.
2) Its not getting the values of textfield or etc that uses has entered into jsp page before submitting.
Can anyone tell me how to find solution for these two points.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会查看在 struts.xml 中定义拦截器的顺序。 您需要确保在正确的位置定义了一个参数拦截器(至少 1 个,模型驱动模式需要 2 个)和一个验证拦截器。 我通常复制默认堆栈(在此处定义),然后根据我的需要修改它。 也许您可以将拦截器堆栈定义添加到您的问题中?
I'd be looking at the order in which you have your interceptors defined in struts.xml. You need to make sure that you have a params interceptor (at least 1, the model driven pattern requires 2) and a validation interceptor defined in the correct place. I generally copy the default stack (defined here) and then modify it for my needs. Perhaps you could add your interceptor stack definition to your question?