【发布时间】:2021-11-15 21:21:28
【问题描述】:
我尝试访问 localhost:8080/hello 但呼吁 localhost:8080/login 唯一显示的是网络状态的状态代码 302,并显示 hello.html 没有启动器,启动器 hello 正在登录
package com.example.biblioteca;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BibliotecaApplication {
public static void main(String[] args) {
SpringApplication.run(BibliotecaApplication.class, args);
}
}
Controller class
package com.example.biblioteca.controller;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class HelloControler {
@GetMapping("/hello")
public String hello() {
return "hello";
}
}
html file:
<html>
<head>
<meta charset ="UTF-8"/>
</head>
<body>
hello working
</body>
</html>
【问题讨论】:
-
请分享你的
pom.xml文件(如果你使用maven) -
请分享您的 application.properties。
-
@mr155 pastebin.com/9a3DXsXC
标签: java spring-boot http networking localhost