SpringBoot怎么访问html文件
2024-09-05 16:30:08
- pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
- application.yml
spring:
thymeleaf:
prefix: classpath:/templates/
- web层
@Controller
public class FdfsController { @RequestMapping("file")
public String file(){
return "/fileUploade";
} }
- html
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
<meta charset="UTF-8" />
<title>Insert title here</title>
</head>
<body>
<h1 th:inlines="text">文件上传</h1>
<form action="upload" method="post" enctype="multipart/form-data">
<p>选择文件: <input type="file" name="fileName"/></p>
<p><input type="submit" value="提交"/></p>
</form>
</body>
</html>
- 测试
最新文章
- Lenovo K29 笔记本经常没声音解决方案Hotkey[gevu18ww].exe
- mysql workbench连接不上远程数据库,xshell无法连接远程主机的问题
- How to setup vsftpd FTP file Server on Redhat 7 Linux
- 用css解决iframe的自适应问题(跨域下同样有用)
- git中通过实际操作来了解常用命令
- NGUI国际化 多语言
- maven使用.02.一些概念
- [Cocos2d-x]节点的生命周期
- linex下部署发布web项目
- java对mysql的增删改查
- JDBC 连接数据库的步骤
- 保护url时效性和安全性的一种解决方案
- 紧急整理了 20 道 Spring Boot 面试题,我经常拿来面试别人!
- Python 面向对象(创建类和对象,面向对象的三大特性是指:封装、继承和多态,多态性)
- wed开发基础--练习题
- 【转】谷歌三大核心技术(一)The Google File System中文版
- 使用 urllib 进行身份验证
- HDU 4864
- [日常] GO语言圣经-并发获取多个URL
- Crond定时任务