This article describes the JSP implementation from the server download XLS file to the client method. Share to everyone for your reference, specific as follows:
Reference to the code on the Internet to write a download xls file to the client's JSP page, as long as the server's file address to the JSP page can be implemented to download files to the client.
<%@ page language= "java" import= "java.util.*" pageencoding= "Utf-8"%> <%@ taglib prefix= "C" uri= "http://" Java.sun.com/jsp/jstl/core "%> <%@ page import=" java.io.* "%> <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<%@ page language= "java" import= "java.util.*" pageencoding= "Utf-8"%> <%@ taglib prefix= "C" uri= "http://" Java.sun.com/jsp/jstl/core "%> <%@ page import=" java.io.* "%> <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
2. Another modified version (download file name can contain Chinese)
<%@ page language= "java" import= "java.util.*,java.net.*" pageencoding= "Utf-8"%> <%@ taglib prefix= "C" uri= " Http://java.sun.com/jsp/jstl/core "%> <%@ page import=" java.io.* "%> <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <meta http-equiv=" content-type "content=" text/html; Charset=utf-8 ">
I hope this article will help you with JSP programming.