Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8148833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:43:23+00:00 2026-06-06T14:43:23+00:00

i am a newbie for java server pages and wrote a code for a

  • 0

i am a newbie for java server pages and wrote a code for a jsp file which involves in jdbc connection and it gives me an error “The method resultString(int, String) is undefined for the type PreparedStatement”. Here’s my source code

<%@ 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>

`

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T14:43:24+00:00Added an answer on June 6, 2026 at 2:43 pm

    there is no method named ps.resultString its public void setString(int parameterIndex,
    String x)
    throws SQLException

    use

     ps.setString(1,Player_No);
    

    Once a PreparedStatement is created (prepared) for the SQL statement, you can insert parameters at the location of the question mark. This is done using the many setXXX() methods.

    xxx can be String ,Int ,…

    the above statement sets Player_No at the first question mark in the SQL Query. as a result SQL query will be as follow :(assuming that request.getParameter(“Player_No”) returns 5 for example)

    "Select * from Player where Player_No=5"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote this simple Java program which connects to internic server and returns the
Java newbie here. I am using a third party library which gives me a
Java newbie here, I'm having trouble setting a new line in this code: String
Hi I am trying out a simple java http server NanoHTTPD: http://elonen.iki.fi/code/nanohttpd/ Today I
newbie doing Java homework here. I have one class named Album which contains the
I'm a java newbie looking for some help reading a file. Here is the
Essentially I want a basic Java Server which multiple people can be connected to
I just got an assignment.It is to design a java socket server which accepts
Java Newbie question : what is the different between getAbsolutePath() and getcanonicalPath() in file
I am a java newbie and I am trying to understand the code given

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.