3. Query out the data, first define the column number of the header and table header, convert the properties of each object to a string[], and then deposit all the converted string[] into list<string[]>, and jexcel the header string[ ] and list<string[]> loop through, converting each substring into a cell in Excel, writing it out into the output stream, and finally converting the output stream to an input stream to return to the download view. Finally, the following methods are presented when the page is accessed. The download view is configured by the Struts.xml., the download view does not jump to the page, after the page click the Download button, after sending the request after the data processing, and finally directly return to the type= "stream" Download view, for file download, the page appears as a click button after the Save prompt box. At the same time, the MIME type of contenttype Zodiac can be found from the Config directory in Tomcat from Web. Xml.
The upload process is done by jexcel the local Excel file after it is read, followed by a row for one object, read as a list<string[]), and then set the string in each row of string[] to each property of an object. Finally, the list <String[]> into a collection of list<employee>.
jexcel+struts2 implementation upload Download, that is, model data exported to Excel format and upload files in Excel format