以下是spring boot和jsp的一个教程。获取以下错误

时间:2018-08-22 10:00:18

标签: java spring spring-boot

错误

发生意外错误(类型=未找到,状态= 404)。

Controller:ApplicationController

@Controller
public class ApplicationController {

    @ResponseBody
    @RequestMapping("/home")
    public String hello()
    {
        return "hello";

    }


    @RequestMapping("/welcome")
    public String welcome()
    {
        return "welcomepage";

    }

}

JSP:welcomepage.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>welcome</title>
</head>
<body>
<h2>welcome to jsp page</h2>
</body>
</html>

application.properties

spring.mvc.view.prefix=/WEB-INF/view/
spring.mvc.view.suffix=.jsp

0 个答案:

没有答案