我现在是用SpringBoot整合的thymeleaf,将templates 里面的html相互调用,好像是不能直接调用,必须要用视图解析器的,但是,不知道视图解析器是怎么用的。也不知道,到底是不是这个问题,就能解决的哈。
用SpringBoot中的接口调用html页面,就可以跳转页面,html中设置
href="http://localhost:8080:name"
这个html中可以进入接口,然后,调用html。
我想让html自己能调用其它html页面哈
<a href="saturnMusicPlay.html">
但是在html中设置了上面的代码,不能html自己调用html,跳转不了
这个可以写一个Controller接口来完成接口跳转:
package com.csdn.demo.web;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class HtmlController {
@GetMapping("/saturnMusicPlay.html")
public String toHtml() {
return "saturnMusicPlay";
}
}
使用超链接跳转不了就是路径有问题,检查一下路径,尽量使用绝对路径