JSP高手进来解决一下,两个异常,帮忙指出。。

sun342115450 2011-09-13 10:33:50
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"
import="java.sql.*"
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
String s = request.getParameter("start");
Connection conn = null;
Statement st = null;
ResultSet rs = null;
String driverName = "com.mysql.jdbc.Driver";
try {
Class.forName(driverName);

String url = "jdbc:mysql://localhost:3306/jdbc";
conn = DriverManager.getConnection(url, "root", "mysql");
st = conn.createStatement();
String sql = "select eno, ename, sex, inDate from emp limit "+s+", 1";

rs = st.executeQuery(sql);
out.print("<table border=1>");
while (rs.next()) {
out.print("<tr>");
out.print("<td>" + rs.getInt("eno") + "</td>");
out.print("<td>" + rs.getString("ename") + "</td>");
out.print("<td>" + rs.getString("sex") + "</td>");
out.print("<td>" + rs.getDate("inDate") + "</td>");
out.print("</tr>");
}
out.print("</table>");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
try {
st.close();
} catch (SQLException e) {
e.printStackTrace();
}
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}

%>

<a href ="sql.jsp?start=0"> 首页 </a>
<a href ="sql.jsp?start=1"> 尾页 </a>
</body>
</html>
...全文
57 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
小笨熊 2011-09-14
  • 打赏
  • 举报
回复
大概看了下,代码没问题哇???
sun342115450 2011-09-13
  • 打赏
  • 举报
回复
搞定了~~不好意思呀
艾小仙 2011-09-13
  • 打赏
  • 举报
回复
异常在哪里?

67,516

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧