1

我的 index.jsp 位于 MyApp/web/views。

在我的 web.xml 我已经设置

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

该页面呈现正常,但在浏览器地址栏中显示:localhost:8080/MyApp

我希望它显示完整的地址,例如 localhost:8080/MyApp/web/views/index.jsp。知道如何制作这个显示器吗?

4

1 回答 1

0

如果你想改变地址栏,你必须告诉浏览器执行一个额外的请求(重定向)。添加一个 HTML 页面MyApp/index.html,其中包含:

<html>
    <head>
        <meta http-equiv="refresh" content="0; URL=web/views/index.jsp" />
    </head>
</html>

使用它,您将不需要您的<welcome-file-list>条目。

于 2012-09-27T08:28:18.790 回答