【发布时间】:2014-06-20 20:49:38
【问题描述】:
当我在 WebLogic 上部署我的 Web 应用程序 (Spring MVC) 时,欢迎页面不会使用默认 URL http://my.site.com/myApp 启动。我在主目录下有我的欢迎页面,我在 web.xml 中设置如下。
<welcome-file-list>
<welcome-file>/home/index.html</welcome-file>
</welcome-file-list>
我可以使用完整的 URL http://my.site.com/myApp/home/index.html 访问该页面。
另外,如果我将 index.html 直接放在根目录下并按如下方式更新 web.xml,欢迎页面将使用默认 URL 启动
<welcome-file>/index.html</welcome-file>
我应该怎么做才能使默认URL启动主目录下的index.html?
这是 web.xml 和 applicationContext.xml 中的代码。
web.xml:
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:/applicationContext.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
applicationContext.xml:
<mvc:default-servlet-handler/>
【问题讨论】:
-
你确定这不是 Spring MVC 的 Web Filter 的问题吗?