zoukankan      html  css  js  c++  java
  • SpringBoot怎么访问html文件

    • 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>
    • 测试

  • 相关阅读:
    获取网卡信息
    MVC Razor
    MVC
    Windows 消息
    sql 总结
    学生成绩表 SQL练习题
    oracle与sqlserver的十大区别
    for的冒泡排序练习题
    对于for的一些认识
    穷举
  • 原文地址:https://www.cnblogs.com/dalianpai/p/11833721.html
Copyright © 2011-2022 走看看