2017-05-23 26 views
0

提及我有在那里我曾提到这样的tomcat如何处理在web.xml

<welcome-file-list> 
    <welcome-file>flows/login.htm</welcome-file></welcome-file-list> 

所以欢迎文件列表时,我打我的应用程序的URL的应用程序的欢迎文件列表即http://localhost:8080/demoApplication

然后它加载欢迎页面,即登录页面。 但在URL它只显示http://localhost:8080/demoApplication 不喜欢http://localhost:8080/demoApplication/flows/login.htm

我想。基本上这个URL“http://localhost:8080/demoApplication”显示这样http://localhost:8080/demoApplication/flows/login.htm 它通过传递我的过滤器之一。

那么tomcat如何处理welcome-file-list,意味着它如何将用户重定向到它。 或者我怎么得到这样的网址http://localhost:8080/demoApplication/flows/login.htm

回答

1

如果你想改变URL,那么你需要发送一个重定向到客户端。否则,客户端认为服务器应答了http://localhost:8080/demoApplication的请求,而不是执行flows/login.htm的内部转发。

在版本8及以上版本中,Tomcat支持configurable rewriting。如果你有早期版本的Tomcat,或者不喜欢内置的重写功能,Tuckey's urlrewrite非常受欢迎。

+0

感谢您的回复,将对此进行调查。 –