简单实现
1、页面上传csv解析成数组;
2、后台字符串生成csv文件并在页面输出下载。
IDEA新建的SpringBoot Demo project
html页面:
控制器
package com.example.demo.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@RestController
@RequestMapping("/file")
public class FileController {
/**
* 导入csv文件
* @param file
<