jsp,rs cannot be resolved
<html><head><scriptsrc="selectUserPhoto.js"></script><title></title></head><body><%@p...
<html>
<head>
<script src="selectUserPhoto.js"></script>
<title></title>
</head>
<body>
<%@page contentType = "text/html;charset=Big5" import = "java.sql.*" %>
<%
String pos_name = request.getParameter("pos");
if(pos_name.equals("all")){
response.sendRedirect("admin.jsp");
}
else{
Class.forName("com.mysql.jdbc.Driver");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/recruit", "root",
"bb201751");
Statement smt = con.createStatement();
String sql = "select * from user where position_applied ='" + pos_name + "'";
ResultSet rs = smt.executeQuery(sql);}
%>
<table style="border : solid 1px yellow">
<font size="5">
<tr><th>User Id</th><th>User Name</th><th>Position applied</th><th>Status</th><th>Profile</th></tr>
<%
while(rs.next())
{
out.println("<tr><td>" + rs.getString(1) + "</td>");
out.println("<td>" + rs.getString(2) + "</td>");
out.println("<td>" + rs.getString(11) + "</td>");
out.println("<td>" + "<select name='status' onchange='update(this.value)'><option value = 'no signed'>no signed "+
"<option value = 'approve'>approve <option value = 'failed'>failed"+"</select></td>");
out.println("<td><input type=button value=Profile onClick=display_profile('" + rs.getString(1) + "') ></td></tr>");
}
con.close();
%>
</table>
</body>
</html>
老报错rs cannot be resolved,求大神指教 展开
<head>
<script src="selectUserPhoto.js"></script>
<title></title>
</head>
<body>
<%@page contentType = "text/html;charset=Big5" import = "java.sql.*" %>
<%
String pos_name = request.getParameter("pos");
if(pos_name.equals("all")){
response.sendRedirect("admin.jsp");
}
else{
Class.forName("com.mysql.jdbc.Driver");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/recruit", "root",
"bb201751");
Statement smt = con.createStatement();
String sql = "select * from user where position_applied ='" + pos_name + "'";
ResultSet rs = smt.executeQuery(sql);}
%>
<table style="border : solid 1px yellow">
<font size="5">
<tr><th>User Id</th><th>User Name</th><th>Position applied</th><th>Status</th><th>Profile</th></tr>
<%
while(rs.next())
{
out.println("<tr><td>" + rs.getString(1) + "</td>");
out.println("<td>" + rs.getString(2) + "</td>");
out.println("<td>" + rs.getString(11) + "</td>");
out.println("<td>" + "<select name='status' onchange='update(this.value)'><option value = 'no signed'>no signed "+
"<option value = 'approve'>approve <option value = 'failed'>failed"+"</select></td>");
out.println("<td><input type=button value=Profile onClick=display_profile('" + rs.getString(1) + "') ></td></tr>");
}
con.close();
%>
</table>
</body>
</html>
老报错rs cannot be resolved,求大神指教 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询