Spring Boot static pages Jump

This blog only for their own reminder: How to Jump page without trouble controller.

When we create Spring Boot project (check the Thymeleaf and Web), the directory structure would be as follows:

      

Figure II is where I created a folder and a index.html html page.

If you want to achieve a jump of static pages (without controller), static files must be placed under static directory.

Because the files in the directory access templates have to go through the controller.

index.html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
    <a href="/html/login.html">登录</a>
</body>
</html>

login.html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="#">
    <input type="text" name="username" placeholder="Username">
    <input type="password" name="password" placeholder="Password">
    <input type="submit" value="Login">
</form>
</body>
</html>

Well, you can enter in the browser http: // localhost: 8080 / test next.

Guess you like

Origin www.cnblogs.com/M-Anonymous/p/11907524.html