2011-04-20 21 views
4

我有一个Spring应用程序,这是Tomcat上运行发言权:http://example.com/foo/重定向从索引页在春季和Tomcat

DisplatcherServlet被映射到应用程序/ *,例如,索引页:

http://example.com/foo/app/index.html 

这是因为我有其他servlet(用于HttpRequestHandlers),例如映射到服务/ *。该方案使用起来很方便,因为这种方式的app /和service /可以有不同的安全设置。

我想要的是http://example.com/foo重定向到http://example.com/foo/app/index.html

我该如何做到这一点?

<welcome-file-list> 
    <welcome-file>index.jsp</welcome-file> 
</welcome-file-list> 

然后,您可以做一个小的index.jsp重定向到你想去的地方:

回答

8

在web.xml中,您可以导航到应用程序的根目录时定义欢迎文件,看到:

<% response.sendRedirect("app/index.html"); %>