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. P1217 [USACO1.5]回文质数 Prime Palindromes(求100000000内的回文素数)

    P1217 [USACO1.5]回文质数 Prime Palindromes 题目描述 因为151既是一个质数又是一个回文数(从左到右和从右到左是看一样的),所以 151 是回文质数. 写一个程序来找 ...

  2. 电脑卡,eclipse Android stadio 卡,什么都卡解决方法

    昨天还好好的,今天什么都没有动就很卡.Android stadio 半天,改了东西才编译.什么都慢一拍,你能感觉到,打开网页也好,什么也好. 莫名的问题,总是被莫名的解决.真的,下了个360杀毒,没效 ...

  3. 朴素贝叶斯python小样本实例

    朴素贝叶斯优点:在数据较少的情况下仍然有效,可以处理多类别问题缺点:对于输入数据的准备方式较为敏感适用数据类型:标称型数据朴素贝叶斯决策理论的核心思想:选择具有最高概率的决策朴素贝叶斯的一般过程(1) ...

  4. xml文件的生成

    关于android中自定义xml文件的生成,请看示例代码(主要来源于黑马教程): import java.io.File; import java.io.FileNotFoundException; ...

  5. Selenium-java 中 对于下拉框 对于网页上的下拉框 如何定位

    WebElement e1 = driver.findElement(By.cssSelector("#s_province")); Select se1 = new Select ...

  6. BZOJ 3990: [SDOI2015]排序(搜索+剪枝)

    [SDOI2015]排序 Description 小A有一个1-2^N的排列A[1..2^N],他希望将A数组从小到大排序,小A可以执行的操作有N种,每种操作最多可以执行一次,对于所有的i(1< ...

  7. tomcat 日志输出

    1.找到tomcat安装目录:cd tomcat/logs 2.tail -f catalina.out 3.ctrl+c 退出

  8. UOJ Goodbye Bingshen

    在叶子童鞋的推荐下打了这场比赛... 感觉被虐爆了... 怎么这么多构造题... 我还没写过呢... 交互题是毛线...看了好久没看懂...就放弃了...(我语文好差QAQ...) 最后只会T1... ...

  9. 倒计时 服务器时间 .NET js javascript

    原文发布时间为:2011-02-07 -- 来源于本人的百度文章 [由搬家工具导入] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tran ...

  10. URLRewrite出现的CSS及图片路径问题

    原文发布时间为:2011-02-24 -- 来源于本人的百度文章 [由搬家工具导入] 例如:把http://www.sofunz.com/house/18649重写到http://www.sofunz ...