【问题标题】:file.html beeing correctly displayed on localhost but not on serverfile.html 正确显示在本地主机上,但不在服务器上
【发布时间】:2018-01-29 15:21:22
【问题描述】:

我正在为我的项目使用 spingboot。我在“模板”下创建了一些子文件夹,并在 maven 上注册了这些域。

registry.addViewController("/websitefolder/mywebsite").setViewName("mywebsite");

我也试过这样:

registry.addViewController("/websitefolder/mywebsite").setViewName("websitefolder/mywebsite");

问题是,在 localhost:8080 上,网页正在正确显示,但在测试服务器上我收到“505”错误。

本地地址:

localhost8080/websitefolder/mywebsite

服务器网址:

ip.ip.ip.ip/server-test/websitefolder/mywebsite

有谁知道 maven 上的注册表是错误的还是我应该做的不同?

感谢您的帮助!

【问题讨论】:

    标签: java maven spring-mvc spring-boot thymeleaf


    【解决方案1】:

    服务器测试是路径吗?如果是这样,您需要更改注册表:

    registry.addViewController("/server-test/websitefolder/mywebsite").setViewName("websitefolder/mywebsite");
    

    【讨论】:

      【解决方案2】:

      只需更改服务器测试路径的注册表

      registry.addViewController
      ("/server-test/websitefolder/mywebsite").setViewName("websitefolder/mywebsite");
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-06-19
        • 2015-05-26
        • 1970-01-01
        • 1970-01-01
        • 2017-07-22
        • 2018-12-19
        相关资源
        最近更新 更多