开发者社区> 问答> 正文

thymeleaf渲染页面的问题?报错

当用thymeleaf模板渲染页面的时候

首先在pom.xml文件中添加依赖

application.properties文件中写入

而后在HelloController.java文件写入

在文件路径src/main/resources/templates下建立index.html文件如下

原本以为在网页中输入网址http://localhost:8080/demo/index后将静态的网页渲染后,用http://blog.didispace.com代替this is a html page! 可结果一直显示index,this is a html page!或者http://blog.didispace.com为什么不显示,还有index.html文件中${host}一直报错,不知什么原因

展开
收起
爱吃鱼的程序员 2020-06-07 18:32:02 659 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB
                        <p>把 HelloController 上的注解 @RestController 改成 <a class="referer" target="_blank">@Controller</a> </p>
    
                    
    
                            嗯嗯  多谢  问题已解决
                        
    
                        <div class='ref'><h4>引用来自“ooknight”的评论</h4><p>把 HelloController 上的注解 @RestController 改成 <a class="referer" target="_blank">@Controller</a> </p>
    
    
                            刚接触这个模板,想问下你在前端是怎么取值的,我百度搜了很多都取不到值
    
    2020-06-07 18:32:17
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载