【发布时间】:2021-10-14 04:25:00
【问题描述】:
当我访问 http://localhost:8080/ 获取我的 Spring Boot 表单时,它只会给我一个白标签错误页面。这是我的控制器代码
package net.codejava;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class MvcController {
@RequestMapping("/")
public String home() {
System.out.println("Going home...");
return "index";
}
}
这是我的 index.jsp 代码
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Volunteer Management Form</title>
</head>
<body>
<h1>Volunteer Management Form</h1>
</body>
</html>
我无法弄清楚为什么它不会显示我确实在控制台中打印了“Going home...”
【问题讨论】:
标签: java spring spring-boot jsp indexing