`

如何配置tomcat项目的默认页面为.action或其他后缀名的方法(文件)

阅读更多
    一般情况下,tomcat项目的默认页面为html、htm和jsp页面,但是我们的主页往往是动态的。比如.action .do 或者使用了其他插件,页面的后缀名不再仅仅是那3种了。

    如果我们直接这样配置的话tomcat是不认可的。
<welcome-file-list>
		<welcome-file>index.action</welcome-file>
	</welcome-file-list>


    其实解决的方法和简单,只要在项目跟目录下建立一个index.action的空文件就ok了。

    根据是tomcat conf下的web.xml中有这样一段注释
引用
<!-- ==================== Default Welcome File List ===================== -->
  <!-- When a request URI refers to a directory, the default servlet looks  -->
  <!-- for a "welcome file" within that directory and, if present,          -->
  <!-- to the corresponding resource URI for display.  If no welcome file   -->
  <!-- is present, the default servlet either serves a directory listing,   -->
  <!-- or returns a 404 status, depending on how it is configured.          -->
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics