为什么我无法将从数据库中提取的出生日期写入jsp页面?
<html>
<body>
<%@ page import="java.sql.*"%>
<%@ page import="java.util.Date"%>
<%
Statement stmt=null;
Connection con=null;
try {
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/testdb","root","");
stmt=con.createStatement();
}
catch(Exception e) {
out.write("<br>database connection problem");
}
ResultSet rs = null;
Date dob= null;
try {
rs=stmt.executeQuery("select * from registrar1 where id='"+id+"';");
while(rs.next()) {
dob = rs.getDate(3);
}
}
catch(Exception e) {
}
%>
Date of Birth : <% out.println(dob); %><br>
</body>
</html>
以下错误由eclipse id:
给出此行找到多个注释: - dob无法解析为 变量