A simple way to implement page export (Excel)

xiaoxiao2021-03-06  49

To implement the table in the page to export into an Excel format, if you use JXL API, you will not avoid too much trouble, here I will introduce a simple export used in our project. First, introduce the principle, Excel can open the html file, everyone should know? (You don't know this? Oh, it is the same way, an HTML file with a table element can also be opened in Excel, so we can use the FORM submission in the page to submit Table content in the page to a JSP or Servlet, then transit the submitted table content into the form of the file stream by JSP or servlet, passed to the client in file download, thereby completes Export Excel features.

The following is a part of the query JSP page partial code: