我在Spring Boot中制作一个Web应用程序。我试图在索引页面加载2.5秒后创建弹出窗口。但是,javascript无法识别路径并引发白标错误。
我所有的网页都在“ src / resources / templates / Pages”内部
index.html:-
while(ros::ok()) {
if (list.flow_message.empty()) {
std::cout << "no messages" << std::endl;
} else {
std::cout << "this is it: " << list.flow_message[0] << std::endl;
}
ros::spinOnce();
}
控制器:-
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Master</title>
<link th:href="@{http://fonts.googleapis.com/css?family=Calibri}" rel='stylesheet' type='text/css' />
<script type="text/javascript">
function myFunction() {
sleep(2500);
newwindow=window.open('Pages/Home.html','MaSTER','height=800,width=1350');
if (window.focus) {
newwindow.focus()
}
return false;
}
function sleep(milliseconds) {
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds){
break;
}
}
}
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<!-- script>
$(document).ready(function(){
$(function(){
$("#footer").load("Master/Pages/Footer.html");
});
});
</script-->
</head>
<body onload="myFunction()">
<div th:text="${message}+' Application'"></div>
<div id="footer" th:insert="Pages/Indexfooter.html"></div>
</body>
</html>
我得到的错误:-
package com.ems.master.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class MasterController {
@RequestMapping("/")
public String index(ModelMap model) {
model.put("message", "Master Manager");
return "Pages/index.html";
}
}
请建议我做什么?