如何使用 Spring Hibernate MVC 将 CSV 文件上传到数据库?
How to upload CSV file to the database using Spring Hibernate MVC?
谁能解释一下"How to upload CSV file to the database using Spring Hibernate MVC?"
您的客户应该创建一个 multipart request。
A HTTP multipart request is a HTTP request that HTTP clients construct
to send files and data over to a HTTP Server.
以最简单的形式处理此类请求的 Spring MVC 处理程序方法类似于:
@RequestMapping(value="fileupload", method=RequestMethod.POST)
public void processUpload(@RequestParam MultipartFile file) throws IOException {
// process your file
}
客户端取决于您的需求(和您的客户),这里是使用 html 表单
的示例
<form id="fileuploadForm" action="fileupload" method="POST" enctype="multipart/form-data">
<label for="file">File</label>
<input id="file" type="file" name="file" />
<p><button type="submit">Upload</button></p>
</form>
下面的教程给你更详细的了解http://www.studytrails.com/frameworks/spring/spring-mvc-file-upload.jsp
谁能解释一下"How to upload CSV file to the database using Spring Hibernate MVC?"
您的客户应该创建一个 multipart request。
A HTTP multipart request is a HTTP request that HTTP clients construct to send files and data over to a HTTP Server.
以最简单的形式处理此类请求的 Spring MVC 处理程序方法类似于:
@RequestMapping(value="fileupload", method=RequestMethod.POST)
public void processUpload(@RequestParam MultipartFile file) throws IOException {
// process your file
}
客户端取决于您的需求(和您的客户),这里是使用 html 表单
的示例<form id="fileuploadForm" action="fileupload" method="POST" enctype="multipart/form-data">
<label for="file">File</label>
<input id="file" type="file" name="file" />
<p><button type="submit">Upload</button></p>
</form>
下面的教程给你更详细的了解http://www.studytrails.com/frameworks/spring/spring-mvc-file-upload.jsp