Ask: SpringBoot 2.0.3 programmatically integrates jsp;jsp pages without rendering but returns the entire page string directly

using springBoot to integrate the jsp,controller,mybatis is all integrated, but when I visit the jsp page, I find that the page is not rendered, but the entire page string is returned directly.

the jsp page is as follows

clipboard.png

controller


jspViewResolver bean;

500.


http://localhost:8080/hello

clipboard.png

you can see from the result that the page is not rendered.
has tried to write the following configuration directly in properties, but the result is the same. Try to access it with another browser, and the result is the same.

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

maven package jar

 <packaging>jar</packaging>
    <build>
        <finalName>ROOT</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</version>
                <configuration>
                    <attach>true</attach>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/webapp</directory>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
    </build>

request in filefox RESTClient

header is as follows


    Status Code: 200
    Accept-Ranges: bytes
    Content-Language: zh-CN
    Content-Length: 315
    Date: Sat, 16 Jun 2018 08:51:57 GMT
    ETag: W/"315-1529136546000"
    Last-Modified: Sat, 16 Jun 2018 08:09:06 GMT

body is as follows

<%@page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/WEB-INF/include/taglib.jsp" %>
<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Helloworld</title>
</head>
<body>
<h1>hello ${account.accountName}</h1>
</body>
</html>
Mar.20,2021

after a day of hard work and watching a lot of springboot projects, I finally found the reason;
maven configuration problem;

misconfiguration is as follows:

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

correctly configured to

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

attach the usage of maven.scope;
the usage of maven.scope

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b9e8fd-2f41b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b9e8fd-2f41b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?