我是 java 服务器页面的新手,并为涉及 jdbc 连接的 jsp 文件编写了代码,它给了我一个错误“方法 resultString(int, String) 未定义为 PreparedStatement 类型”。这是我的源代码
<%@ page import = "java.sql.*"%>
<html>
<head>
<title>Player Details</title>
</head>
<body>
<center>
Welcome to Players Details Page
<br><br>
Player Details are
<br><br>
<table border=7>
<tr>
<td>Player No</td>
<td>Player Name</td>
<td>Country</td>
<td>Club</td>
</tr>
<%
String Player_No = request.getParameter("Player_No");
try
{
Class.forName("oracle.jdbc.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:SYSTEM/rambabu@localhost:8081:XE");
PreparedStatement ps = con.prepareStatement("Select * from Player where Player_No=?");
ps.resultString(1,Player_No);
ResultSet rs = ps.executeQuery();
if(rs.next())
{
%>
<tr>
<td><%=rs.getString(1) %></td>
<td><%=rs.getString(2) %></td>
<td><%=rs.getString(3) %></td>
<td><%=rs.getString(4) %></td>
</tr>
<%
}
rs.close();
ps.close();
con.close();
}
catch(Exception e)
{
System.out.println(e);
}
%>
</table>
</center>
</body>
</html>
`