为了账号安全,请及时绑定邮箱和手机立即绑定

jsp的导出 我这代码错哪。。。。。求大神帮忙

jsp的导出 我这代码错哪。。。。。求大神帮忙

兜兜的麦兜 2015-04-13 17:44:03
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><%@ page language="java" contentType="text/html; charset=UTF-8"    pageEncoding="UTF-8"  import="java.sql.*"%><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>普通话水平测试报名系统</title></head><body><center>  <p>&nbsp;</p>  <p>&nbsp;</p>  <p>&nbsp;</p>  <p class="STYLE1">报名信息查询</p>  <form method="post" action="xx-ym.jsp">  <p>&nbsp;</p>  <p>    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    <input type="submit" name="Submit" value="返回">  </p></form>  <table height="40" border="1" align="center" ><tr><td width="40"  style="display:none;">报名序号</td> <td width="100">学号</td><td width="100">姓名</td><td width="100">学院</td><td width="100">专业</td><td width="100">班级</td><td width="150">身份证号码</td><td width="40">性别</td><td width="100">出生年月</td><td width="100">籍贯</td><td width="80">名族</td><td width="90">联系电话</td></tr></table></center><%request.setCharacterEncoding("UTF-8");String bj=request.getParameter("a1");String driverClass="com.mysql.jdbc.Driver";String url="jdbc:mysql://localhost:3306/atao";String uname="root";String upass="958672";Connection conn=null;Class.forName(driverClass);conn=DriverManager.getConnection(url,uname,upass);PreparedStatement stmt=conn.prepareStatement("select * from student where classes=?");stmt.setString(1,bj); ResultSet rs=stmt.executeQuery(); while(rs.next()){ %> <center> <%        String exportToExcel = request.getParameter("exportToExcel");        if (exportToExcel != null                && exportToExcel.toString().equalsIgnoreCase("YES")) {            response.setContentType("application/vnd.ms-excel");            response.setHeader("Content-Disposition", "inline; filename="                    + "excel.xls");         }    %> <form action="" method="post"> <table height="40" border="1" align="center" ><tr><td width="40"  style="display:none;"> <%=rs.getString(12)%></td><td width="100"><%=rs.getString(1) %></td><td width="100"> <%=rs.getString(2) %></td><td width="100"> <%=rs.getString(3) %></td><td width="100"> <%=rs.getString(4) %></td><td width="100"> <%=rs.getString(5) %></td><td width="150"> <%=rs.getString(6) %></td><td width="40"> <%=rs.getString(7) %></td><td width="100"> <%=rs.getString(8) %></td><td width="100"> <%=rs.getString(9) %></td><td width="80"> <%=rs.getString(10) %></td><td width="90"> <%=rs.getString(11) %></td>      </table>      <p align="right">           <%        if (exportToExcel == null) {    %>                      <a href="ycx-conf.jsp?exportToExcel=YES">Export to Excel</a>               <%        }    %>               </center>               <%              }         rs.close(); stmt.close(); conn.close();  %>                           </tr></p>         <p>&nbsp;</p>         <p>&nbsp;</p> </form> </body></html>
查看完整描述

目前暂无任何回答

  • 0 回答
  • 0 关注
  • 1614 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信