Paste my own POM code first:
1 <?xml version="1.0" encoding="UTF-8"?>
2 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4 <modelVersion>4.0.0</modelVersion>
5 <parent>
6 <groupId>org.springframework.boot</groupId>
7 <artifactId>spring-boot-starter-parent</artifactId>
8 <version>1.5.6.RELEASE</version>
9 <relativePath/> <!-- lookup parent from repository -->
10 </parent>
11 <groupId>com.sblueice</groupId>
12 <artifactId>demo</artifactId>
13 <version>0.0.1-SNAPSHOT</version>
14 <packaging>war</packaging>
15 <name>demo</name>
16 <description>Demo project for Spring Boot</description>
17
18 <properties>
19 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20 <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
21 <java.version>1.8</java.version>
22 </properties>
23
24 <dependencies>
25 <dependency>
26 <groupId>org.springframework.boot</groupId>
27 <artifactId>spring-boot-starter-web</artifactId>
28 </dependency>
29 <dependency>
30 <groupId>javax.servlet</groupId>
31 <artifactId>javax.servlet-api</artifactId>
32 <scope>provided</scope>
33 </dependency>
34
35 <!--sppourt jsp -->
36 <dependency>
37 <groupId>javax.servlet</groupId>
38 <artifactId>jstl</artifactId>
39 <version>1.2</version>
40 </dependency>
41
42 <dependency>
43 <groupId>com.mchange</groupId>
44 <artifactId>c3p0</artifactId>
45 <version>0.9.5.2</version>
46 </dependency>
47 <!-- Setting it to provided will exclude the package when packaging, as it is not needed to be put into a standalone tomcat to run. -->
48 <dependency>
49 <groupId>org.springframework.boot</groupId>
50 <artifactId>spring-boot-starter-tomcat</artifactId>
51 <scope>provided</scope>
52 </dependency>
53 <dependency>
54 <groupId>org.springframework.boot</groupId>
55 <artifactId>spring-boot-starter-test</artifactId>
56 <scope>test</scope>
57 </dependency>
58 <dependency>
59 <groupId>org.springframework.boot</groupId>
60 <artifactId>spring-boot-devtools</artifactId>
61 <optional>true</optional>
62 </dependency>
63 <dependency>
64 <groupId>org.springframework.boot</groupId>
65 <artifactId>spring-boot-starter-jdbc</artifactId>
66 </dependency>
67 <dependency>
68 <groupId>org.mybatis.spring.boot</groupId>
69 <artifactId>mybatis-spring-boot-starter</artifactId>
70 <version>1.3.2</version>
71 </dependency>
72 <dependency>
73 <groupId>mysql</groupId>
74 <artifactId>mysql-connector-java</artifactId>
75 <scope>runtime</scope>
76 </dependency>
77
78 </dependencies>
79
80 <build>
81 <plugins>
82 <plugin>
83 <groupId>org.springframework.boot</groupId>
84 <artifactId>spring-boot-maven-plugin</artifactId>
85 </plugin>
86 <plugin>
87 <groupId>org.apache.maven.plugins</groupId>
88 <artifactId>maven-compiler-plugin</artifactId>
89 <version>3.1</version>
90 <configuration>
91 <source>1.8</source>
92 <target>1.8</target>
93 </configuration>
94 </plugin>
95 </plugins>
96 </build>
97
98 </project>
Modification 1: first, the parent class depends on the version number, which is changed from 2.0.1 to 1.5.6 according to Baidu
Modification 2: again, the error of importing JSP dependency: missing artifact org.apache.tomcat.embedded: Tomcat embedded Jasper: jar: 8.5.16
If you don’t add a JSP dependency, you can download the JSP file directly and report an error if you add it. Now I’m confused
Record it, there is a great God answer is more desirable
October 10, 2019 has been solved:
Finally, it was found that there was a problem with the version. It was tested from 1.5.6 to 2.0.3. It was found that there was no problem with the version 2.0.3, which proved that this version was suitable for my computer and my eclipse
Operating system: win10 64 bit
Eclipse: Version: 2019-09 R (4.13.0)
Maven should be 3.5.0
1. The following are the dependencies required by JSP :
<!--servlet begin -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<!--servlet end -->
<!--jsp begin -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!--jsp end -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
2. Add the prefix in application.yml
spring:
mvc:
view:
prefix: /WEB-INF/views
suffix: .jsp
—-Encourage with you