我是 Spring Boot 的新手,并尝试加载 jsp 页面,但即使经过多次尝试并在互联网上搜索后,我也找不到任何解决方案。我无法在整个过程中找到导致错误的部分。
为了构建这一切,我在命令提示符下使用了命令“gradle build”。
要启动服务器,我使用了命令:- java -jar build\libs\one-0.0.1-SNAPSHOT.war
然后我在浏览器上输入:- http://localhost:8080/helloWorld
这是我的build.gradle
plugins {
id 'org.springframework.boot' version '2.2.2.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
id 'war'
}
group = 'com.tm'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
providedRuntime 'javax.servlet:jstl'
providedRuntime 'org.apache.tomcat.embed:tomcat-embed-jasper'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
test {
useJUnitPlatform()
}
这是我的控制器HelloJSPController.java的java代码,它位于这个文件夹结构中:\src\main\jav