Struts 2执行操作而不是欢迎文件 [英] Struts 2 Execute action instead of welcome file
本文介绍了Struts 2执行操作而不是欢迎文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发Struts 2应用程序,我想执行一个动作(实际上,我对执行拦截器更感兴趣),而不是简单地显示欢迎文件.实现此目标的最佳方法是什么?
I'm working on a Struts 2 application and I want to execute an action (in fact I'm interested more on executing an interceptor) instead of simply showing a welcome file. What is the best way to achieve this?
提前谢谢!
推荐答案
从欢迎文件重定向到操作,或将操作URL用作欢迎文件条目.
Either redirect to the action from the welcome file, or use the action URL as a welcome file entry.
要执行后者,您可能需要在元素上设置调度程序元素:
To do the latter, you'll likely need to set dispatcher elements on the element:
<filter-mapping>
<dispatcher>REQUEST</dispatcher>
etc.
还添加FORWARD,INCLUDE和ERROR,以及正常的过滤器名称/URL.
Add FORWARD, INCLUDE, and ERROR as well, and the normal filter name/url.
这篇关于Struts 2执行操作而不是欢迎文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文