项目结构如图:

Spring-boot项目使用jsp页面

①、要自己在main目录下新建存放jsp页面的目录:/webapp/WEB-INF/views/index.jsp

②、添加3个依赖

Spring-boot项目使用jsp页面

③、在application.properties中添加jsp的访问格式:

Spring-boot项目使用jsp页面

④、编写Controller中的代码

Spring-boot项目使用jsp页面

⑤、结果如下:

Spring-boot项目使用jsp页面

注意:官网不推荐spring-boot项目使用jsp页面;例外。。我也感觉这样相当之复杂,还要建目录。还是早点弃jsp的坑。

相关文章:

  • 2021-11-24
  • 2022-12-23
  • 2021-08-07
  • 2021-06-02
  • 2021-08-11
  • 2021-06-16
  • 2021-10-16
  • 2021-11-01
猜你喜欢
  • 2021-12-30
  • 2022-01-26
  • 2022-01-02
  • 2022-01-14
  • 2022-12-23
  • 2021-04-18
  • 2021-07-11
相关资源
相似解决方案