新手,各种错误,郁闷,求指教
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<jsp:directive.page import="java.sql.DriverManager"/>
<jsp:directive.page import="java.sql.Connection"/>
<jsp:directive.page import="java.sql.Statement"/>
<jsp:directive.page import="java.sql.ResultSet"/>
<jsp:directive.page import="java.sql.Date"/>
<jsp:directive.page import="java.sql.Timestamp"/>
<jsp:directive.page import="java.sql.SQLException"/>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<a href="addPerson.jsp">新建人员资料</a>
<%
Connection conn=null;
Statement stmt=null;
ResultSet rs=null;
try{
DriverManager.registerDriver(new com.mysql.jdbc.Driver());
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/databaseWeb","root","1992618");
stmt=conn.createStatement();
rs=stmt.executeQuery("select * from tb_person");
%>
<form action="operatePerson.jsp" method=get>
<table bgcolor="#CCCCCC" cellspacing=1 cellpadding=5 width=100%>
<tr bgcolor=#DDDDDD>
<th></th>
<th>ID</th>
<th>姓名</th>
<th>英文名</th>
<th>性别</th>
<th>年龄</th>
<th>生日</th>
<th>备注</th>
<th>记录创建时间</th>
</tr>
<%
while (rs.next()){
int id=rs.getInt("id");
int age=rs.getInt("age");
String name=rs.getString("name");
String english_name=rs.getString("english_name");
String sex=rs.getString("sex");
String description=rs.getString("description");
Date birthday=rs.getDate("birthday");
Timestamp createTime=rs.getTimestamp("create_time");
out.println("<tr bgcolor=#FFFFFF>");
out.println("<td><input type=checkbox name=id value="+id+"></td>");
out.println("<td>"+id+"</td>");
out.println("<td>"+name+"</td>");
out.println("<td>"+english_name+"</td>");
out.println("<td>"+sex+"</td>");
out.println("<td>"+age+"</td>");
out.println("<td>"+birthday+"</td>");
out.println("<td>"+description+"</td");
out.println("<td>"+createTime+"</td>");
out.println("<td>");
out.println("<a href='operatePerson.jsp?action=del&id="+id+"'onclick='return confirm(\"确定删除该记录?\")'>删除</a>");
out.println("<a href='operatePerson.jsp?action=edit&id="+id+"'>修改</a>");
out.println("</td>");
out.println("</tr>");
}
%>
</table>
<table align=left>
<tr>
<td>
<input type=hidden value='del' name='action'>
<a href='#' onclick="
var array=document.getElementByName('id');
for(var i=0;i<array.length;i++){
array[i].checked=true;
}">全选
</a><a href='#'onclick="var array=document.getElementByName('id');for(var i=0;i<array.length;i++){array[i].checked=false;}">取消全选</a>
<input type='submit' onclick='return confirm(\"即将删除所选择的记录。是否删除?\")'value='删除'>
</td></tr></table></form>
<%
}catch(SQLExceptioin e){
out.println("发生了异常:"+e.getMessage());
e.printStackTrace();
}
finally{
if(rs!=null)
rs.close();
if(stmt!=null)
stmt.close();
if(conn!=null)
conn.close();
}%>
</body>
</html>
出现的错误:Multiple annotations found at this line:
- Syntax error, insert ") Statement" to complete
ForStatement
- Attribute value (
var array=document.getElementByName('id');
for(var i=0;i<array.length;) not closed.
- Syntax error, insert ") Statement" to complete
ForStatement
- Attribute value (
var array=document.getElementByName('id');
for(var i=0;i<array.length;) not closed.
Multiple annotations found at this line:
- Cannot return from outside a function or
method.
SQLExceptioin cannot be resolved to a type
求教啊,在线等