springboot项目创建教程 https://blog.csdn.net/q18771811872/article/details/88126835

springboot 2.0跳转 html教程 https://blog.csdn.net/q18771811872/article/details/88312862

jsp+html跳转整合 https://blog.csdn.net/q18771811872/article/details/88343672

这是一篇单独跳转jsp页面的教程 ,后续会介绍html和jsp同时存在的 我暂时注释了thymeleaf模版以及配置

1创建目录结果和jsp文件

2配置return 返回模版 及代码

@RequestMapping(value = "/testJsp", produces = "application/json;charset=UTF-8", method = {RequestMethod.POST, RequestMethod.GET})
public String testJsp(Model m, HttpServletRequest request, HttpServletResponse response){
List<Map<String,Object>> list=userService.userQueryAll();
request.setAttribute("list",list);
log.info("进入了testJsp方法!");
return "views/testJsp";
}

3.application.yml 文件 配置 thymeleaf 模版参数

spring:
dataSource:
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://localhost:3306/db-test?useUnicode=true&characterEncoding=utf8&tinyInt1isBit=false&usessl=false
username: root
password: 123456
driverClassName: com.mysql.jdbc.Driver
mvc:
view: #新版本 1.3后可以使用
suffix: .jsp
prefix: /WEB-INF/
view: #老版本 1.4后被抛弃
suffix: .jsp
prefix: /WEB-INF/

4. pom.xml 文件加入tomcat和jsp支持 ,如果是有thymeleaf架包的暂时注释掉,这里只写jsp跳转( 有thymeleaf架包的时候return模版会优先跳转html页面)

<!--tomcat支持-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<!--servlet依赖.-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<!--jsp标签库-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>

5. jsp页面这里直接用了EL表达式

<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html >
<html lang="zh-CN">
<head>
<title>Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script src="<%=basePath%>static/js/jquery-3.3.1.js" charset="utf-8"></script>
</head>
<body>
<table border="1">
<thead>
<tr>
<th>序号</th>
<th>名字</th>
<th>号码</th>
<th>创建时间</th>
</tr>
</thead>
<tbody>
<c:forEach items="${list}" var="listv" varStatus="status">
<tr>
<td>${listv.id}</td>
<td>${listv.name}</td>
<td>${listv.phone}</td>
<td>${listv.create_time}</td>
</tr>
</c:forEach>
</tbody>
</table> </body>
<script type="text/javascript" charset="utf-8"> </script>
</html>

6. Project Structure里面 这个一般是默认配置好了的,如果没有就要加上哦

就这样启动就行了  效果图如下

原文地址 https://blog.csdn.net/q18771811872/article/details/88342298

springboot 2.0跳转 html教程 https://blog.csdn.net/q18771811872/article/details/88312862

jsp+html跳转整合 https://blog.csdn.net/q18771811872/article/details/88343672

springboot项目创建教程 https://blog.csdn.net/q18771811872/article/details/88126835

springboot 2.0.8 跳转jsp页面的更多相关文章

  1. springboot 2.0.8 跳转html页面

    springboot项目创建链接 https://blog.csdn.net/q18771811872/article/details/88126835 springboot2.0 跳转jsp教程 h ...

  2. 多模块springboot项目启动访问不了jsp页面

    被springboot项目maven打包.启动.访问折腾的头都大了,一步一个坑,在解决了所有的问题之后,那种欣喜若狂的心情只有自己能体会,决定要好好记录一下了,废话不多说了,直接进入正题. 问题和排查 ...

  3. 分享url带中文参数,打开html操作完毕跳转jsp页面中文乱码解决

    1.在app端分享参数组合时不对传递的url进行任何编码. 2.打开html页面时使用 escape函数对有中文的参数进行编码 escape(GetQueryString("paramete ...

  4. springboot跳转jsp页面

    springboot支持jsp页面跳转 官方不推荐jsp的支持(jar包不支持jsp,jsp需要运行在servletContext中,war包需要运行在server服务器中如tomcat)官方推荐使用 ...

  5. springboot 2.0 整合 同时支持jsp+html跳转

    springboot项目创建教程 https://blog.csdn.net/q18771811872/article/details/88126835 springboot2.0 跳转html教程  ...

  6. springboot 运行jar 跳转jsp页面

    pom.xml 添加 <!-- tomcat支持 --> <dependency> <groupId>org.springframework.boot</gr ...

  7. springboot+jsp+mybatis项目实例(后台成功,但是无法跳转jsp页面,没有实体类的注解,看springboot+jsp第二弹相关配置,即可成功配置jsp)

    SpringBoot是用来简化SpringMvc开发的项目,这里自然要整合mybatis等持久化框架! 先看看项目目录: 一.在pom.xml中配置依赖jar包:<project xmlns=& ...

  8. request.getRequestDispatcher跳转jsp页面失败

    我在JS里面写了个Ajax,传值给控制器,然后利用request.getRequestDispatcher(),打算跳转至另外一个页面.但是没有跳转成功,运行之后没反应. 在网上搜了资料发现,利用aj ...

  9. 18. 进livebos对象直接跳转jsp页面的做法

    在网格脚本定义添加: window.onload=function(){     window.location.href='/plug-in/sinopec/contractManagement/h ...

随机推荐

  1. 详细的Windows下安装 binwalk

    1. https://github.com/ReFirmLabs/binwalk到这里下载binwalk,下载后解压. 2. 找到下载后的文件夹, 在这里要进行安装步骤,一边按着shift,一边按着鼠 ...

  2. java setVisible顺序不同导致窗体内容不显示问题

    今天学习JAVA编写窗体的时候,先写了setVisible(true);然后才去创建的各种控件以及设置大小.位置等 结果运行后只显示空白的窗体,必须最小化再最大化或点击一下边框,才显示窗体内容(即必须 ...

  3. 用户注册,登录API 接口

    Controer: <?php /** * @name UserController * @author pangee * @desc 用户控制器 */ class UserController ...

  4. Java 语言概述与开发环境(1)

    目录: 一.计算机语言的发展史 二.Java语言的简述 三.Java的特点 四.java语言的运行环境及环境变量的配置 五.Dos的常见命令 六.第一个java程序-HelloWord        ...

  5. server.xml属性概念

    # system Processers为系统可用的线程数,一般和CPU核心线程数相同 BufferPool 是由BufferChunk组成. BufferPool的总大小为BufferChunkSiz ...

  6. 多IP指定出口IP地址 如何指定云服务器源IP?

    如果一个主机绑定有多个IP地址,那么在被动响应和主动发起连接两种方式中,源IP地址的选择机制肯定是有所差异的.主机在接收外部数据包,并发送响应数据包时,响应源地址显然就是客户端请求的地址,这是非常容易 ...

  7. 【bzoj1316】树上的询问 树的点分治+STL-set

    题目描述 一棵n个点的带权有根树,有p个询问,每次询问树中是否存在一条长度为Len的路径,如果是,输出Yes否输出No. 输入 第一行两个整数n, p分别表示点的个数和询问的个数. 接下来n-1行每行 ...

  8. 并查集:按秩合并 $n$ 个点所得树高不超过 $\lfloor\log n \rfloor$

    用 $h_n$ 表示按秩合并 $n$ 个点所得树的最大高度. 有 $h_1 = 0, h_2 = 1, h_3 = 1, h_4 = 2, h_5 = 2, \dots$ 有如下地推: \[ h_n ...

  9. BZOJ4002 [JLOI2015]有意义的字符串 【数学 + 矩乘】

    题目链接 BZOJ4002 题解 容易想到\(\frac{b + \sqrt{d}}{2}\)是二次函数\(x^2 - bx + \frac{b^2 - d}{4} = 0\)的其中一根 那么就有 \ ...

  10. RTSP会话基本流程

    RTSP会话基本流程 RTSP交互流程: C表示RTSP客户端,S表示RTSP服务端 ① C->S: OPTION request //询问S有哪些方法可用 S->C: OPTION re ...