FirstJsp 出现问题 在线等
实现简单功能:查询oracle表中数据,然后放到table中。
<body>
<%!
Connection getConnection(){
Connection conn=null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
conn=DriverManager.getConnection("jdbc:orac:thin:@localhost:1521:orcl","system","njniit");
}catch(Exception e){
e.printStackTrace();
}
return conn;
}%>
<%
String sql="select sid,stuname from stuinfo";
Connection conn= getConnection();
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery(sql);
%>
<center>
<table border="1" style="color:blue">
<caption style="color:red">学生表</caption>
<tr>
<td>学号</td><td>姓名</td>
</tr>
<% while(rs.next()){
%>
<tr>
<td><%=rs.getInt(1)%></td>
<td><%=rs.getString(2)%></td>
</tr>
<%}%>
</table>
</center>
</body>
语法掩盖没错误,可是调试总是不能实现