<!DOCTYPE html>
<%@ page contentType="application/msexcel;charset=utf-8" %>
<%@ page pageEncoding="UTF-8" language="java"%>
<%@ taglib uri="/tags/loushang-web" prefix="l"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page isELIgnored="false"%>
<%@ page import="java.net.URLDecoder"%>
<meta http-equiv="Content-Type" content="application/msexcel; charset=utf-8">
<html lang="en">
<head>
<title>核验列表</title>
</head>
<body>
    <table align="left" border="2">
        <thead>
            <tr >
                <th>序号</th>
                <th>机构名称</th>
                <th>组织机构代码</th>
                <th>统一社会信用码</th>
                <th>机构库查询结果</th>
                <th>代码中心查询结果</th>
            </tr>
        </thead>
        <tbody>
            <c:forEach items="${datacontextMap.data}" var="item" varStatus="status">
             <tr>
             <td><c:out value="${status.index+1}"/></td>
             <td><c:out value="${item.organization}"/></td>
             <td><c:out value="${item.organization_code}"/></td>
             <td><c:out value="${item.organization_uscc}"/></td>
             <c:choose>
    <c:when test="${item.local_result== '1' }">  
           <td>不存在</td>
   </c:when>
   <c:when test="${item.local_result== '2' }">  
           <td>存在</td>
   </c:when>
    <c:otherwise> 
     <td>全部</td>
    </c:otherwise>
</c:choose>
<c:choose>
    <c:when test="${item.unitcenter_result== '1' }">  
           <td>不存在</td>
   </c:when>
   <c:when test="${item.unitcenter_result== '2' }">  
           <td>存在</td>
   </c:when>
    <c:otherwise> 
     <td>全部</td>
    </c:otherwise>
</c:choose>
             </tr>
            </c:forEach>
        </tbody>
    </table>
</body>
 <% String ExcelName = "核验列表.xlsx";
     ExcelName=new String(ExcelName.getBytes("GB2312"), "ISO_8859_1");//解决文件名为中文时文件错误的问题
            response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
            response.setHeader("Content-Disposition", "inline; filename="
                    + ExcelName);
    %>
</html>打开当前页面就会导出excel,报错信息如下图如果导出xls格式是没有问题,header和ContentType这么写的话:
 response.setContentType("application/vnd.ms-excel");
            response.setHeader("Content-Disposition", "inline; filename="
                    + ExcelName+".xls");
但是现在要求导出xlsx格式,求助大佬们,帮看看。