IT_newbies 2016-07-12 06:27 采纳率: 52.9%
浏览 2034

jsp页面的数据导出到excel (jsp页面里已从数据库里取出了数据放到了List里面)

这是jsp页面的代码,已取出了userList,就是不会打印到excel
........................................
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
/c:set
<%
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
%>
<!DOCTYPE html>



通讯录列表


















当前位置: 人力资源 >  考勤管理 >  通讯录管理 >  通讯录列表




















            <input type="hidden" id="currPageNum" name="currPageNum" value="${page.currPageNum }">
            <input type="hidden" id="orderColumn" name="orderColumn" value="${page.orderColumn }">
            <input type="hidden" id="orderMode" name="orderMode" value="${page.orderMode }">
            <input type="hidden" id="pageSize" name="pageSize" value="${page.pageSize }">
            <input type="hidden" id="total" name="total" value="${page.totalPageCount }">
        </form>
        <table border="0" cellpadding="0" width="1000px" cellspacing="0">
          <tbody>
            <tr>
              <td style="text-align:left;">&nbsp; 共${page.totalCount }条记录&nbsp;&nbsp;&nbsp;&nbsp;</td>
              <td align="right" width="200">共 <font color="red">${page.totalPageCount }</font> 页&nbsp;&nbsp;当前第 <font color="red">${page.currPageNum } </font>页&nbsp;&nbsp; </td>
              <td width="70">转到<input size="3" class="skip" id="go" onKeyDown="return go_onkeydown('report')">页 </td>
              <td width="30px"><table cellpadding="0" cellspacing="0" style="cursor: pointer; height: 22px; width: 100%">
                    <tr>
                      <td align="center" class="right_btn first"><img src="${stx }/images/back.png" width="13" height="8"></td>
                    </tr>
                </table></td>
              <td width="30px"><table cellpadding="0" cellspacing="0" style="cursor: pointer; height: 22px; width: 100%"">
                    <tr>
                      <td align="center" class="right_btn prev"><img src="${stx }/images/pre.png" width="7" height="9"></td>
                    </tr>
                </table></td>
              <td width="30px"><table cellpadding="0" cellspacing="0" style="cursor: pointer; height: 22px; width: 100%">
                    <tr>
                      <td align="center" class="right_btn next"><img src="${stx }/images/next.png" width="7" height="9"></td>
                    </tr>
                </table></td>
              <td width="30px"><table cellpadding="0" cellspacing="0" style="cursor: pointer; height: 22px; width: 100%" >
                    <tr>
                      <td  align="center" class="right_btn last"><img src="${stx }/images/forward.png" width="13" height="8"></td>
                    </tr>
                </table></td>
            </tr>
          </tbody>
        </table>

        <table class="outside_table maintain_list" cellspacing="1" cellpadding="0" style="width: 1000px; border:0px;">
            <tr>
                <th id="user_name_col" class="title_bg order" style="min-width: 70px; width: 70px;" nowrap="nowrap">姓名</th>
                <th id="user_code_col" class="title_bg order" style="min-width: 60px; width: 60px;" nowrap="nowrap">编号</th>
                <th id="fk_dept_id_col" class="title_bg order" nowrap="nowrap">部门</th>
                <th id="duty_col" class="title_bg order" style="min-width: 60px; width: 60px;" nowrap="nowrap">职务</th>
                <!-- 
                    <th class="title_bg" style="min-width: 50px; width: 50px;" nowrap="nowrap">等级</th>
                -->
                <th id="join_date_col" class="title_bg order" style="min-width: 80px; width: 80px;" nowrap="nowrap">入司日期</th>
                <th id="sex_col" class="title_bg order" style="min-width: 60px; width: 60px;" nowrap="nowrap">性别</th>
                <th id="status_col" class="title_bg order" style="min-width: 80px; width: 80px;" nowrap="nowrap">系统状态</th>
                <th id="oa_status_col" class="title_bg order" style="min-width: 80px; width: 80px;" nowrap="nowrap">岗位状态</th>
                <th class="title_bg" style="min-width: 50px; width: 50px;" nowrap="nowrap">详细</th>
            </tr>
            <c:if test="${not empty userList }">
                <c:forEach items="${userList }" var="user" varStatus="s">
                    <c:if test="${(s.index)%2==1 }">
                        <tr class="even">
                    </c:if>
                    <c:if test="${(s.index)%2==0 }">
                        <tr class="odd">
                    </c:if>
                        <td>${user.userName }</td>
                        <td>${user.userCode }</td>
                        <td>${user.dept.nameAll }</td>
                        <td>${user.duty }</td>
                        <!-- 
                        <td>${user.dutyLevel }</td>
                        -->
                        <td>${user.joinDate }</td>
                        <td>${user.sex }</td>
                        <td>${user.oaStatus }</td>
                        <td>${user.status }</td>
                        <td><a class="btn" href="${stx }/oa/user/getTxlDetail?userId=${user.userId }">详细</a></td>
                    </tr>
                </c:forEach>
            </c:if>
            <c:if test="${empty userList }">
                <tr>
                    <th colspan="10" class="bg_textcont">无相关信息</th>
                </tr>
            </c:if>
        </table>
    </div>
</div>

<script src="${stx }/js/jquery-1.12.0.min.js"></script>
<script src="${stx }/js/orderlist.js"></script>


  • 写回答

3条回答 默认 最新

  • Bug开发攻城狮 2016-07-12 06:48
    关注

    打印ecxel?
    js来打印excel的方式感觉兼容性很成问题
    如果是使用后台的方式下载excel,参考下 http://blog.csdn.net/zy_281870667/article/details/51356713

    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料