【问题标题】:welcome page does not display full address in browser欢迎页面未在浏览器中显示完整地址
【发布时间】:2012-09-27 04:06:01
【问题描述】:

我的 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。 知道如何制作这个显示器吗?

【问题讨论】:

    标签: jsp web.xml


    【解决方案1】:

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

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

    使用它,您将不需要您的 &lt;welcome-file-list&gt; 条目。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-20
      • 2013-06-07
      • 2013-05-14
      • 2015-07-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多