Idea开发工具之SpringBoot整合JSP的过程
作者:蹦蹦跳的鼻涕泡 时间:2023-06-14 19:50:23
SpringBoot体系内推荐使用Thymeleaf作为前端页面模板。jsp还得自己整合一下。
1.项目结构
对比以前的项目结构,main目录下多了webapp目录,用来存放jsp文件。
webapp目录为我们手动创建,所以需要在IDEA中进行配置,指定webapp目录为项目的Web资源目录。
首先在main目录下创建一个webapp目录
点击这个小图标(这里没有的可以File->Project Structure 或使用快捷键Ctrl+Alt+Shift+S)
接下来跟着图片教程一步步走
我们可以看到webapp这个目录的图标已经变了
2.配置文件
修改全局配置文件application.properties,指定SpringMVC视图的前后缀,支持使用JSP文件作为视图
spring.mvc.view.prefix=/WEB-INF/jsp/ 这个路径是webapp下的
spring.mvc.view.suffix=.jsp//后缀
3.引入依赖
<!-- 添加jstl标签库依赖 -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<!-- 添加jsp引擎依赖,SpringBoot内置tomcat没有此依赖 -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
至此,就能使用了。
来源:https://blog.csdn.net/weixin_45919491/article/details/120282757
标签:SpringBoot,JSP,idea
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
javascript实现促销倒计时+fixed固定在底部
2024-05-11 09:33:04
使用Python来开发微信功能
2023-09-25 00:05:28
![](https://img.aspxhome.com/file/2023/5/120275_0s.jpg)
Python中用max()方法求最大值的介绍
2021-12-08 09:33:06
MySQL编码不一致可能引起的一些问题
2024-01-21 17:26:15
Python实现简单截取中文字符串的方法
2022-09-08 01:43:48
asp导出CSV格式数据
2008-12-24 21:25:00
python使用openCV遍历文件夹里所有视频文件并保存成图片
2023-05-30 18:14:22
![](https://img.aspxhome.com/file/2023/6/103186_0s.png)
python实现扫雷小游戏
2023-02-15 11:58:58
![](https://img.aspxhome.com/file/2023/9/76699_0s.gif)
python调用excel_vba的两种实现方式
2023-01-07 19:37:37
![](https://img.aspxhome.com/file/2023/1/101631_0s.png)
C#三种判断数据库中取出的字段值是否为空(NULL) 的方法
2024-01-22 06:57:17
CentOS7 64位下MySQL5.7安装与配置教程
2024-01-17 16:32:12
![](https://img.aspxhome.com/file/2023/1/107911_0s.jpg)
MySQL数据库远程访问权限如何打开(两种方法)
2024-01-26 12:58:48
JavaScript数组去重的方法总结【12种方法,号称史上最全】
2024-05-09 15:02:46
python自动发邮件库yagmail的示例代码
2022-01-15 14:23:26
![](https://img.aspxhome.com/file/2023/0/83720_0s.png)
JavaScript观察者模式原理与用法实例详解
2024-04-19 10:02:48
![](https://img.aspxhome.com/file/2023/4/135924_0s.png)
Pytest 自动化测试框架的使用
2022-11-12 16:47:46
Python使用MYSQLDB实现从数据库中导出XML文件的方法
2024-01-14 21:03:01
python基于搜索引擎实现文章查重功能
2022-01-21 19:25:50
![](https://img.aspxhome.com/file/2023/2/67322_0s.png)
python+selenium实现京东自动登录及秒杀功能
2021-02-08 13:31:41
JavaScript 关于引用那点事
2009-11-28 18:44:00