Struts 2 First Page是否可以通过引擎而不是在< welcome-file-list>中列出? [英] Can Struts 2 First Page come through the engine instead of listing it in <welcome-file-list>?

查看:66
本文介绍了Struts 2 First Page是否可以通过引擎而不是在< welcome-file-list>中列出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我的Web应用程序启动时,我都需要在< welcome-file-list> 中提供欢迎或索引或第一个文件.

Whenever my web application starts, I need to provide the welcome or index or first file inside the <welcome-file-list>.

之后,我可以使用< s:form> < s:a> 中的操作将请求发布到struts引擎通过Struts 2加载我的Web应用程序的索引页或首页,即初始请求本身应该通过引擎,并且响应应该仅来自引擎,这可能吗?

There after, I am able to post requests to the struts engine using actions in <s:form> or in <s:a> I want to load the index page or the first page of my web application through Struts 2 i.e. the initial request itself should pass through the engine, and the response should come from the engine only, is it possible?

推荐答案

如果您在JSP页面内使用Struts标记,则列出的欢迎文件或不欢迎的文件应为操作的 dispatcher 结果.如果您导航到Web内容层次结构的文件夹,并且其中有一个欢迎文件,并且没有映射到该URL的操作,则Web容器可以处理欢迎文件列表文件.在这种情况下,您将无法在欢迎文件中使用struts标记,因为您尝试在没有关联过滤器的情况下运行它,或者struts2过滤器已经处理了另一个请求.

If you are using Struts tags inside JSP page, either it welcome file listed or not it should be a dispatcher result of an action. Welcome file list files could be handled by the web container if you navigate to the folder of your web content hierarchy and there's a welcome file inside it, and there's no action mapped to that URL. In this case you cannot use struts tags inside the welcome file because you are trying to run it without associated filter, or the struts2 filter is already handled another request.

请参见您好的示例World 应用程序或使用Struts2的Hello World ,它将向您展示如何使用

See the examples of Hello World application or Hello World using Struts2 that would show you how to create action configuration that utilize an index action or use actionless results using Convention Hello World example.

这篇关于Struts 2 First Page是否可以通过引擎而不是在&lt; welcome-file-list&gt;中列出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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