spring boot 通过controller跳转到指定 html 页面问题以及请求静态资源问题
1. 项目结构

2. pom文件配置
重点是红色框内的依赖

3. application配置文件

4. controller
注意使用@Controller注解;
@RestController 等价于 @Controller 加上 @ResponseBody.
如果使用@RestController则会把结果写到响应的正文内容当中,不会进行跳转操作;

5. controller 跳转到指定页面配置
注意上方controller返回的路径
下面路径的两个 / 都不能省略


6. 请求静态资源路径配置



7. 访问界面效果
spring boot 通过controller跳转到指定 html 页面问题以及请求静态资源问题的更多相关文章
- 微信小程序页面跳转的问题(app.json中设置tarBar后wx.redirectTo和wx.navigateTo均不能实现跳转到指定的页面)
1.设置的tabBar代码片段: "tabBar": { "list": [ { "pagePath": "pages/homep ...
- jFinal render为什么不跳转到指定的页面
jFinal render为什么不跳转到指定的页面 1:需要在你自己的主配置文件里面配置所有页面的文件前缀,没配置默认是项目的根目录 //配置页面访问主路径 me.setBaseViewPath(&q ...
- Spring Boot的Controller控制层和页面
一.项目实例 1.项目结构 2.项目代码 1).ActionController.Java: package com.example.controller; import java.util.Date ...
- spring boot 项目在启动时执行指定sql文件
参考博客: https://www.jianshu.com/p/88125f1cf91c 1. 启动时执行 当有在项目启动时先执行指定的sql语句的需求时,可以在resources文件夹下添加需要执行 ...
- spring boot利用controller来测试写的类
我们在开发spring boot应用程序的时候,往往需要测试某个写好的类,但是在测试的时候发现不太好测试,用Junit等测试框架,总是会报一些问题,大致是找不到配置文件以及无法利用spring创建的对 ...
- spring boot 启动自动跳到 断点 throw new SilentExitException
项目 debug 启动,自动跳到 断点 ,而且就算F8 ,项目还是停止启动. 百度了一下,答案都是 Eclipse -> Preferences ->Java ->Debug去掉&q ...
- Eclipse使用Debug模式调试Spring Boot项目时跳转到exitCurrentThread的问题
Spring Boot项目使用了spring-boot-devtools工具且在Eclipse中Debug调试会自动跳转到这个方法: public static void exitCurrentThr ...
- spring boot之创建web项目并访问jsp页面
1,创建spring boot的web项目 刚创建好的项目路径如下: 2,pom中要有下面的依赖 <dependency> <groupId>org.springframewo ...
- Spring Boot 2.x基础教程:找回启动日志中的请求路径列表
如果您看过之前的Spring Boot 1.x教程,或者自己原本就对Spring Boot有一些经验,或者对Spring MVC很熟悉.那么对于Spring构建的Web应用在启动的时候,都会输出当前应 ...
随机推荐
- 【原】The Linux Command Line - Workiing with commands
● type – Indicate how a command name is interpreted● which – Display which executable program will b ...
- Java ArrayList调用构造方法传入"容量size"不生效,如何初始化List容量size
创建一个ArrayList对象,传入整型参数 @Test public void arrayListConstructor(){ ArrayList<Object> objects = n ...
- 用element-ui 时,报value.getTime is not a function错误:
在用element-ui 时,报value.getTime is not a function错误:错误分析:date-picker 的时间是格林威时间,如果Thu Jun 22 2017 19:07 ...
- Django+Vue.js框架快速搭建web项目
一.vue环境搭建1.下载安装node.js.2.安装淘宝镜像cnpm,在命令窗口输入: npm install -g cnpm --registry=https://registry.npm.tao ...
- window.location.href 页面不跳转解决
function login() { var userid = $("#username").val(); var userpwd = $("#pwd").va ...
- 3. Go语言基本类型
Go语言基本类型如下: bool string 数值类型 (int8, int16, int32, int64, int, uint8, uint16, uint32, uint64, uint, f ...
- centos 搭建git 服务器
安装 git yum -y install git 添加git 用户 adduser git 切换到git 用户 su git 在git用户家目录下创建 .ssh文件夹 mkdir .ssh 修改文 ...
- est-framework框架的基本组件
rest-framework框架的基本组件 快速实例 Quickstart 序列化 创建一个序列化类 简单使用 开发我们的Web API的第一件事是为我们的Web API提供一种将代码片段实例序列 ...
- Could not transfer artifact org.springframework
无法从中心仓库获取该版本的信息, 从新下载: 1.配置eclipse中的maven user setting路径为本地maven安装路径 配置阿里云镜像路径 <mirror> <i ...
- 解决 “access violation at address xxxxxxxxx”错误
在进行磁盘整理的时候,打开Foxmail的时候出现了“access violation at address32383137”错误 和“access violation at address00000 ...
