-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I want to send data to database from selected excel file by using zk framework. The send button is using to send data from uploaded excel file to data base . Can you give me guide step by step ?
This can be done using the ZK-compatible Keikai Spreadsheet component. This tutorial shows how it can be done.
I'll try to go into each aspect of your question:
DB: ZK doesn't include/prefer any database layer -> which means you have to choose yourself a library/framework to access your database and store the data, e.g. JDBC, hibernate, JPA, spring-data ... (that's outside the scope of ZK).
File Upload: In order to upload a file from a zul page you can use a file upload button:
<button upload="true" label="Import"/>
Then register an onUpload
event listener, to handle the uploaded file contents. Retrieved from UploadEvent.getMedia().getByteData() / .getStreamData()
Extract Data from Excel File: Once you have the binary data, you need to process/parse it (e.g. using the apache POI library), which then allows you to access specific sheets/regions to extract data. Then use your persistence library from above to store the data into tables as needed.
If you need a manual approach for the user to select which data range to export you can use Keikai to import/display the spreadsheet to the user, let him/her select a region before storing it to a DB (as mentioned by @jeanher)
(Note: Keikai requires at least ZK 8.0.5 so you'd have to upgrade your older zk version 6.5.7.1)
Asked: 2020-04-09 15:09:25 +0800
Seen: 10 times
Last updated: Apr 14 '20
zk怎么实现动态字段的页面显示,我需要整合一个统计表,而这个统计表的显示字段是动态获取的,这个怎么办
When I used Echarts ,it is report an error
Difference between selenium-support and selenium-java jars
org.zkoss.zk.ui.UiException: You cannot access components belong to other desktop
How open an url/page passing big data parameters
save_user_template python code problem [closed]