关于springboot直接访问静态页面小记

原文链接: https://blog.csdn.net/a1194821568/article/details/90752803
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/a1194821568/article/details/90752803

本人在研究springboot开发项目时遇到访问静态页面的问题在这里记录一下

首先建立springboot项目,然后在static下加入html页面,下面的是我的项目结构
在这里插入图片描述
启动项目,当在/static/文件夹下有index.html或者 /static/html/文件夹下有index.html 时 直接访问IP+端口号 会访问到index页面
在这里插入图片描述
上面这张图片是借用的如有问题请联系本人删除
在这里插入图片描述
其他的页面需要通过制定页面访问例如:http://localhost:8888/html/fileindex.html
在这里插入图片描述
如果想访问动态页面需要在pom中加入Thymeleaf的依赖 然后通过controller动态访问
参考:https://blog.csdn.net/a1194821568/article/details/90719896

本人只是为了记录自己的经历,如果侵犯到您的权益 ,请与[email protected]联系

                                </div>
            <link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-e9f16cbbc2.css" rel="stylesheet">
                </div>
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/a1194821568/article/details/90752803

本人在研究springboot开发项目时遇到访问静态页面的问题在这里记录一下

首先建立springboot项目,然后在static下加入html页面,下面的是我的项目结构
在这里插入图片描述
启动项目,当在/static/文件夹下有index.html或者 /static/html/文件夹下有index.html 时 直接访问IP+端口号 会访问到index页面
在这里插入图片描述
上面这张图片是借用的如有问题请联系本人删除
在这里插入图片描述
其他的页面需要通过制定页面访问例如:http://localhost:8888/html/fileindex.html
在这里插入图片描述
如果想访问动态页面需要在pom中加入Thymeleaf的依赖 然后通过controller动态访问
参考:https://blog.csdn.net/a1194821568/article/details/90719896

本人只是为了记录自己的经历,如果侵犯到您的权益 ,请与[email protected]联系

                                </div>
            <link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-e9f16cbbc2.css" rel="stylesheet">
                </div>

猜你喜欢

转载自blog.csdn.net/u013771019/article/details/102683435
今日推荐