
hi, i have a database with field merchant_code, merchant_name, city, region,
and also have html page with all above mentioned field
i have submit 20 record from front end of html file to my database like that 001 sajal Noida North
002 suresh Kanpur East
003 Divest Delhi South
... ... ...
now my question is that
if i have a report page with same four above filed
and i type any letter in the text field of merchant name then suggest all merchant name in the form of drop down list like if i type s sajal Suresh
and on select any value rest of all three field display related value which i insert in the database
plz help me i have to submit my project

Here is a jsp code that display the records into textfields according to the id entered by user.
1)ajax.jsp:
<%@page import="java.sql.*"%>
<html>
<head>
<script type="text/javascript">
function showData(){
xmlHttp=GetXmlHttpObject()
var id=document.getElementById("id").value;
var url="getdata.jsp";
url=url+"?id="+id;
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged(){
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
var showdata = xmlHttp.responseText;
var strar = showdata.split(":");
if(strar.length>1)
{
var strname = strar[1];
document.getElementById("name").value= strar[1];
document.getElementById("address").value= strar[2];
}
}
}
function GetXmlHttpObject(){
var xmlHttp=null;
try{
xmlHttp=new XMLHttpRequest();
}
catch(e){
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
</script>
</head>
<body>
<form >
<br><br>
<table >
<tr><td>Client ID:</td><td><input type="text" id="id" name="id" onkeyup="showData();"></td></tr>
<tr><td>Name:</td><td><input type="text" id="name" name="name"></td></tr>
<tr><td>Address:</td><td><input type="text" id="address" name="address"></td></tr>
</table>
</body>
2)getdata.jsp:
<%@ page import="java.sql.*" %>
<%
int id = Integer.parseInt(request.getParameter("id"));
String data=" ";
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("Select * from addclients where clientid ="+id+"");
while(rs.next())
{
data = ":" + rs.getString("name") + ": " + rs.getString("address");
}
out.println(data);
}
catch(Exception e){
System.out.println(e);
}
%>
</html>
For more information, visit the following link:

Thanks Sir
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.