Java JSP Application Export Excel report simple implementation and Chinese garbled completely solve (HTML) __oracle

Source: Internet
Author: User
Web application Export Excel report simple implementation (HTML)
In Web applications, much of the data is often exported to Excel documents. Creating a real Excel document in a specific way is more complex and less useful. So it's often a simple way to save a report in HTML format and then open it in Excel.
Implementation mode:
The first step is to use JSP to implement the HTML version of the report
In the second step, set the response contenttype in the JSP page header to Excel format
Quoting <% Response.setcontenttype ("APPLICATION/VND.MS-EXCEL;CHARSET=GBK"); %>

Chinese questions:
View source code found in the JSP file written in Chinese as garbled, then add a line to the head of the JSP file
Reference <%@ page contenttype= "text/html; charset=gb2312 "%> View source code found text is Chinese, but with Excel open as garbled then in Quoting <meta http-equiv= "Content-type" content= "text/html; CHARSET=GBK ">
A servlet implementation is a similar approach.

Implementation sample: Test.jsp

Java code    <%@ page contenttype= "TEXT/HTML;&NBSP;CHARSET=GBK"  %>   <%  response.setcontenttype ("APPLICATION/VND.MS-EXCEL;CHARSET=GBK"); %>   <HTML>    <meta http-equiv= "Content-type"  content= "TEXT/HTML;&NBSP;CHARSET=GBK" >  
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.