03-01:springboot 整合jsp
1.修改pom文件,添加坐标
<!-- jstl -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<!-- jasper -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
2. 创建Controller
@Controller
public class UserController {
@RequestMapping("/showUser")
public String showUser(Model model) {
List<Users> list = new ArrayList<>();
list.add(new Users(1,"张三",20));
list.add(new Users(2,"李四",22));
list.add(new Users(3,"王五",24));
model.addAttribute("list", list);
return "userList";
}
3.建立jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SpringBoot 整合JSP</title>
</head>
<body>
<table border="1" align="center" width="50%">
<tr>
<th>ID</th>
<th>Name</th>
<th>Age</th>
</tr>
<c:forEach items="${list}" var="user">
<tr>
<td>${user.id }</td>
<td>${user.name }</td>
<td>${user.age }</td>
</tr>
</c:forEach>
</table>
</body>
</html>
4.修改application.properties配置文件
#prefix : 是指访问页面的前缀,指定页面存放的文件夹
spring.mvc.view.prefix=/WEB-INF/jsp/
# suffix : 是指文件的后缀名,常见的后缀名有html,jsp,php,txt,mp3
spring.mvc.view.suffix=.jsp
03-01:springboot 整合jsp的更多相关文章
- SpringBoot整合Jsp和Thymeleaf (附工程)
前言 本篇文章主要讲述SpringBoot整合Jsp以及SpringBoot整合Thymeleaf,实现一个简单的用户增删改查示例工程.事先说明,有三个项目,两个是单独整合的,一个是将它们整合在一起的 ...
- springboot整合jsp模板
springboot整合jsp模板 在使用springboot框架里使用jsp的时候,页面模板使用jsp在pom.xnl中需要引入相关的依赖,否则在controller中无法返回到指定页面 〇.搭建s ...
- SpringBoot整合jsp技术
1.修改pom.xml文件 <?xml version="1.0" encoding="UTF-8"?> <project xmlns=&qu ...
- Idea中SpringBoot整合JSP
最近在学习SpringBoot,看到SpringBoot整合jsp,顺带记录一下. 1.创建一个SpringBoot项目 点击Next 注意:packaging选中War,点击Next Webà选中W ...
- 【SpringBoot】08.SpringBoot整合jsp
SpringBoot整合jsp 1.修改pom文件加入两个坐标jstl标签库和jasper <project xmlns="http://maven.apache.org/POM/4. ...
- springboot整合jsp,完成公交车站路线图
转: springboot整合jsp,完成公交车站路线图 点赞再看,养成习惯 开发环境: jdk 8 intellij idea tomcat 8 mysql 5.7 maven 3.6 所用技术: ...
- 1、SpringBoot整合之SpringBoot整合JSP
SpringBoot整合JSP 一.创建SpringBoot项目,仅选择Web模块即可 二.在POM文件中添加依赖 <!-- 添加servlet依赖模块 --> <dependenc ...
- springboot整合jsp报错
今天在学springboot整合jsp时遇到了一个问题,虽然jsp不被spring官方推荐使用,但抱着学习的心态还是想解决一下这个问题.在写好了需要pom文件之后,访问网站得到了500的错误提示,后台 ...
- springboot整合JSP以及发布项目到独立的tomcat中与打成jar包使用
之前研究了springboot整合freemarker与thymeleaf的使用.也研究了springboot发布到独立的tomcat的使用以及使用自带的tomcat打成jar包的使用,下面研究集成J ...
随机推荐
- VIP之CVI CVO
3. VIP CVI CVO 在开始时,对于CVI和CVO是不知道应该怎样去调试的,就是不知道应该从哪里去确认是对还是错. 关于这一点从再次看到关于数据包的格式才明朗的.去分析CVI和输出 ...
- AngularJS实战之ngAnimate插件实现轮播
第一步:引入angular-animate.js 第二步:注入ngAnimate var lxApp = angular.module("lxApp", [ 'ngAnimate' ...
- python中global 和 nonlocal的使用
1.global关键字用来在函数或其他局部作用域中使用全局变量.但是如果不修改全局变量也可以不使用global关键字. gcount = 0 def global_test(): gcount+=1 ...
- 如何批量下载网站中的超链接(一次性下载网页中所有可能的PDF文件)
最近公司在做工程项目,实现文件批量下载. 网上找了很久,发现网上的代码都有相似的问题,不过最终还是让我找到了一个符合的项目. 工程: 进行项目文件下载功能分析,弄清楚文件批量下载的原理,提供的数据支持 ...
- shell实现linux回收站的功能
shell实现linux回收站的功能 下载: https://gitee.com/LoongWang/shellrecycling/repository/archive/master.zip 代码: ...
- LoadIcon
1.LoadIcon(HINSTANCE hInstance,LPCSTR lpIconName);该函数从与 hInstance 模块相关联的可执行文件中装入lpIconName指定的图标资源,仅当 ...
- (转)使用 vs.php 调试PHP
转自:http://www.jb51.net/article/24618.htm 早先在asp横行的年代,php和asp一样,大都都是html中夹杂代码,说实话,这时候IDE的确用处不是很大,倒是 ...
- Beta阶段第五篇Scrum冲刺博客-Day4
1.站立式会议 提供当天站立式会议照片一张 2.每个人的工作 (有work item 的ID),并将其记录在码云项目管理中: 昨天已完成的工作. 张晨晨:目标增加单词收藏功能 郭琪容:学习收藏功能的实 ...
- shell 命令 --ps aux | grep
ps aux | grep 要查询的进程名 查询当前进程,如 ps aux | grep python 确认过需要查询的进程,就可以进行 kill -9 进程号等操作了.
- unigui1404在delphi10.2.2安装
unigui1404在delphi10.2.2安装 UNIGUI1404不能直接在DELPHI10.2.2下面编译安装,在10.2.1下面是可以的. 这里讲下怎样安装的方法: 1)执行FMSoft_u ...