【JSP开源代码栏目提醒】:网学会员,鉴于大家对JSP开源代码十分关注,论文会员在此为大家搜集整理了“EX13-4.jsp”一文,供大家参考学习!
<%@ page language="java" contentType="application/vnd.ms-excel; charset=GB2312" %><%@ page import="java.sql.*"%>
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 11">
<link rel=File-List href="EX13-04.files/filelist.xml">
<link rel=Edit-Time-Data href="EX13-04.files/editdata.mso">
<link rel=OLE-Object-Data href="EX13-04.files/oledata.mso">
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Created>1996-12-17T01:32:42Z</o:Created>
<o:LastSaved>2008-01-02T13:52:21Z</o:LastSaved>
<o:Version>11.9999</o:Version>
</o:DocumentProperties>
<o:OfficeDocumentSettings>
<o:RemovePersonalInformation/>
</o:OfficeDocumentSettings>
</xml><![endif]-->
<style>
<!--table
{mso-displayed-decimal-separator:"\.";
mso-displayed-thousand-separator:"\,";}
@page
{margin:1.0in .75in 1.0in .75in;
mso-header-margin:.5in;
mso-footer-margin:.5in;}
tr
{mso-height-source:auto;
mso-ruby-visibility:none;}
col
{mso-width-source:auto;
mso-ruby-visibility:none;}
br
{mso-data-placement:same-cell;}
.style0
{mso-number-format:General;
text-align:general;
vertical-align:bottom;
white-space:nowrap;
mso-rotate:0;
mso-background-source:auto;
mso-pattern:auto;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
border:none;
mso-protection:locked visible;
mso-style-name:常规;
mso-style-id:0;}
td
{mso-style-parent:style0;
padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
border:none;
mso-background-source:auto;
mso-pattern:auto;
mso-protection:locked visible;
white-space:nowrap;
mso-rotate:0;}
ruby
{ruby-align:left;}
rt
{color:windowtext;
font-size:9.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-char-type:none;
display:none;}
-->
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:Name>Sheet1</x:Name>
<x:WorksheetOptions>
<x:DefaultRowHeight>285</x:DefaultRowHeight>
<x:CodeName>Sheet1</x:CodeName>
<x:Selected/>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</x:ExcelWorksheet>
<x:ExcelWorksheet>
<x:Name>Sheet2</x:Name>
<x:WorksheetOptions>
<x:DefaultRowHeight>285</x:DefaultRowHeight>
<x:CodeName>Sheet2</x:CodeName>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</x:ExcelWorksheet>
<x:ExcelWorksheet>
<x:Name>Sheet3</x:Name>
<x:WorksheetOptions>
<x:DefaultRowHeight>285</x:DefaultRowHeight>
<x:CodeName>Sheet3</x:CodeName>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
<x:WindowHeight>4530</x:WindowHeight>
<x:WindowWidth>8505</x:WindowWidth>
<x:WindowTopX>480</x:WindowTopX>
<x:WindowTopY>120</x:WindowTopY>
<x:AcceptLabelsInFormulas/>
<x:ProtectStructure>False</x:ProtectStructure>
<x:ProtectWindows>False</x:ProtectWindows>
</x:ExcelWorkbook>
</xml><![endif]-->
</head>
<body link=blue vlink=purple>
<%Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance(); //加载JDBC驱动
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=school"; //school为你的数据库
String user="sa"; //连接数据库的用户名
String password="123"; //连接数据库的密码
Connection conn= DriverManager.getConnection(url,user,password); //数据库连接对象
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); //SQL语句对象
String sql="select * from Student"; //创建SQL语句
ResultSet rs=stmt.executeQuery(sql); //执行SQL语句并取得结果集
%>
<table x:str border=0 cellpadding=0 cellspacing=0 width=144 style='border-collapse:
collapse;table-layout:fixed;width:108pt'>
<col width=72 span=2 style='width:54pt'>
<% //向后依次逐条取出数据
while(rs.next()) {%>
<tr height=19 style='height:14.25pt'>
<td height=19 width=72 style='height:14.25pt;width:54pt'><%=rs.getString(1)%></td>
<td width=72 style='width:54pt'><%=rs.getString(2)%></td>
<td width=72 style='width:54pt'><%=rs.getString(3)%></td>
<td width=72 style='width:54pt'><%=rs.getString(4)%></td>
<td width=72 style='width:54pt'><%=rs.getString(5)%></td>
</tr>
<%}%>
<![if supportMisalignedColumns]>
<tr height=0 style='display:none'>
<td width=72 style='width:54pt'></td>
<td width=72 style='width:54pt'></td>
</tr>
<![endif]>
</table>
<%rs.close(); //关闭结果集
stmt.close(); //关闭SQL语句对象
conn.close(); //关闭数据库
%>
</body>
</html>
上一篇:
EX13-3.jsp
下一篇:
法律专业开题报告范文