为什么在尝试在Spring Boot应用程序中运行jsp页面时出现Whitelabel错误页面

时间:2019-05-13 16:13:35

标签: java spring spring-boot jsp

我正在尝试访问springboot应用程序中的.jsp页面,但出现Whitelabel错误页面。发生意外错误(类型=未找到,状态= 404)。/flightreservation / WEB-INF / jsp / registerUser.jsp

这是我的控制器类

@Controller
public class UserController {

    @RequestMapping("/showReg")
    public String showRegistrationPage() {
        return "registerUser";
    }

    }

这是application.properties

spring.datasource.url=jdbc:mysql://localhost:3306/reservation?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=ma123

spring.jpa.show-sql=true

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


server.servlet.context-path=/flightreservation

这是pom.xml

<properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

0 个答案:

没有答案