spring boot访问 jsp实例,SpringBoot访问JSP实例
以下是一个简单的Spring Boot项目示例,演示如何配置Spring Boot以访问JSP页面。
确保你有一个Java开发环境,例如Java 8及以上版本。

1. 创建一个新的Spring Boot项目:
```shell
mvn archetype:generate -DgroupId=com.example -DartifactId=spring-boot-jsp-example -Dversion=1.0.0-SNAPSHOT -Dpackage=com.example
```
2. 修改`src/main/java/com/example/springbootjspexample/SpringBootJspExampleApplication.java`文件,添加一个控制器:
```java
package com.example.springbootjspexample;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
@SpringBootApplication
public class SpringBootJspExampleApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootJspExampleApplication.class, args);
}
@GetMapping("