简体   繁体   English

使用Java在GWT中上传和读取Excel文件

[英]Upload and read excel file in GWT using java

I am using GWT with java. 我在Java中使用GWT。 in my application i should upload excel file and should read the content of excel file and store data in entity. 在我的应用程序中,我应该上传excel文件,并应读取excel文件的内容并将数据存储在实体中。 I have multiple columns in my excel sheet and i need to map them with my fields in the entity. 我的Excel工作表中有多个列,我需要将它们与实体中的字段进行映射。 please suggest me how to achieve this. 请建议我如何实现这一目标。 for example : I have customer Names in excel sheet i need to save them in database/entity on click of button any help. 例如:我在excel表中有客户名称,我需要在单击任何帮助按钮时将其保存在数据库/实体中。

For uploading a file you need a multipart upload form.GWT supports this with the FormPanel and the FileUpload widget. 要上传文件,您需要一个分段上传表单.GWT通过FormPanel和FileUpload小部件支持此表单。

If the server implementation is done in Java, you need an Servlet that handles the upload. 如果服务器实现是用Java完成的,则需要一个Servlet处理上载。 Apache Commons Fileupload will help you handling the request. Apache Commons Fileupload将帮助您处理请求。 As mentioned above Apache POI can help parsing the Excel document. 如上所述,Apache POI可以帮助解析Excel文档。

You can upload excel file as any file. 您可以将excel文件上传为任何文件。 The detailed gwt example you can find here 您可以在此处找到详细的gwt示例

http://www.celinio.net/techblog/?p=1207 http://www.celinio.net/techblog/?p=1207

To read from excel you have to use Apache POI APIs for microsoft docs. 要从excel阅读,您必须对Microsoft文档使用Apache POI API。 https://poi.apache.org/ https://poi.apache.org/

You can use the following example to make yourself familiar with the excel api's 您可以使用以下示例使自己熟悉excel api的

How to read and write excel file in java 如何在Java中读写Excel文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM