Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet how to retreive values from MS Access Database based on the values entered in textbox values in jsp file
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


umar
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file
1 Answer(s)      2 years and 9 months ago
Posted in : JSP-Servlet


Hi am new to java. i need to create a dynamic web application. Am using eclipse IDE and Apache tomcat server. i need to create a tool. Someone please kindly help me out and post your code for my following problem. My Project requirement is as follows: I have a table in batchlogs.mdb in MS Access Database. the table structure is Sno JobName ProgramName Problem Resolution. 1 bs001 abcd01 program got abended with 803 error illegal operation check data

And i have a jsp file which contains a textbox, name issuedescription. when user types in their issues in the textbox and click the submit button it should search in the database fields JobName, ProgramName and Problem whether any single match is found for the value in text box and if found it should retrieve the corresponding Solution field from database and display in the textbox of the jsp.


Advertisement
View Answers

March 27, 2012 at 5:31 PM


1)checkid.jsp:

<%@page import="java.sql.*"%>
<html>
<head>
<script type="text/javascript">
function showData(){ 
xmlHttp=GetXmlHttpObject()
    var id=document.getElementById("id").value;
var url="id.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("type").value= strar[1];
        document.getElementById("price").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>
<br><br>
<table >
<tr><td>ID:</td><td><input type="text" id="id" name="id" onkeyup="showData();"></td></tr>
<tr><td>Product Type:</td><td><input type="text" id="type" name="name"></td></tr>
<tr><td>Price:</td><td><input type="text" id="price" name="address"></td></tr>
</table>
</body>
</html>

2)id.jsp:

<%@ page import="java.sql.*" %> 
<%
String id = request.getParameter("id").toString();
System.out.println(id);
String data ="";
try{
           Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
           Connection con = DriverManager.getConnection("jdbc:odbc:student");
           Statement st=con.createStatement();
           ResultSet rs=st.executeQuery("select * from item where itemid='"+id+"'");
while(rs.next())
{
 data = ":" + rs.getString("item") + ": " + rs.getString("price");
}
  out.println(data);
  System.out.println(data);
}
catch(Exception e) {
System.out.println(e);
}
%>


Related Tutorials/Questions & Answers:
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file  Hi am new to java. i need to create... Solution field from database and display in the textbox of the jsp.   1
how to insert values from jsp into ms access
how to insert values from jsp into ms access   how to insert values using jsp into ms access database
Advertisements
How to insert data from a combobox and textbox values into DB using JSP?
How to insert data from a combobox and textbox values into DB using JSP?  hi, How to insert a comb-box and a text box values in to DB using JSP? @DB:student; @table:stu_info; Combobox values:(class1,class2,class3); textbox1
how to display values from database into table using jsp
how to display values from database into table using jsp  I want to display values from database into table based on condition in query, how... the values from database based on the bookname or authorname entered must be display
How to insert dynamic textbox values into database using Java?
How to insert dynamic textbox values into database using Java?  Hi I am trying to insert dynamic textbox values to database, my jsp form have 2... these dynamic textbox values to database(Oracle 11g)...Please help me out. I have
Autopopulate values into textbox from database on pressing tab or on clicking
Autopopulate values into textbox from database on pressing tab... to be searched into database. if it already exists then it will autopopulate its... on the producttype(which is first textbox related to product_id).This is need
insert values from excel file into database
the following link: Insert values from excel file to database...insert values from excel file into database   hi i want to insert values from Excel file into database.Whatever field and contents are there in excel
how to read values from excel sheet and compare with database using jsp
how to read values from excel sheet and compare with database using jsp  hi sir i am arun how to read values from excel sheet and compare with database using jsp coding i.e, if i have 6(assetid,assetname,serialno,cubical
reading dropdown values from properties file in jsp
reading dropdown values from properties file in jsp  reading dropdown values from properties file in jsp
how to get the values from dynamically generated textbox in java?
how to get the values from dynamically generated textbox in java?  I... textbox corresponding to the data. I want to get data from textboxes(generated as per the retrieved data) and I want to store textbox values into the two table
How to show database values into graph using jsp?
How to show database values into graph using jsp?  How to show database values into graph using jsp
How to show database values into graph using jsp?
How to show database values into graph using jsp?  How to show database values into graph using jsp
How to fetch entries/values from database to a jsp page one by one?
How to fetch entries/values from database to a jsp page one by one?  ... and data and each column has 10 enteries. I have a jsp page on which i want to display different database entries of the each column in different blocks. Now
getting values from database - JSP-Servlet
JSP code separately.If it will not display database values then try your code...getting values from database  I tried the following code abc.html aaa.jsp I am not getting exceptions now
How to edit values in textboxes from database using jsp
How to edit values in textboxes from database using jsp  Hi RoseIndia... from database table using jsp, here is my code Please can anyone help me...(); System.out.println("Disconnected from database"); %> <br>
how to fetch values from .properties to a html file
how to fetch values from .properties to a html file  I have a .properties file with some key value pairs in it. I need to fetch the values from this .properties file into a html file.Please let me know how to do
How to create file from input values in Jframe ?
How to create file from input values in Jframe ?  hi i m doing my... text1; void form() { frame=new JFrame("details you have entered are"); JPanel... to take these details and make a file that can be appended each time.how
how to generate automatic bill based on selected values using jsp/javascript?
how to generate automatic bill based on selected values using jsp/javascript?  how to generate automatic bill based on selected values using jsp/javascript
How to pass multiple values from a servlet to JSP?
How to pass multiple values from a servlet to JSP?  hi, I want to pass multiple values form a servlet to JSP. Hw do i do that? I am able to send one value at a time without any prb, but I am unable to carry multiple (from two
How to carry multiple values from a Servlet to a JSP?
How to carry multiple values from a Servlet to a JSP?  By using the below code I am able to carry the username to a JSP (single value... needs to be carried from my servlet to a JSP. How do I do
how to set the values in jsp
how to set the values in jsp  how to set the values text boxs in jsp frm dbase via servlet
To Retain the values entered in the text box after submit in jsp page
To Retain the values entered in the text box after submit in jsp page  ... box , data is retreived from the database and displayed in table format. I have given all those. Now my problem is how can i retain those values entered in box
how to get the values to dropdownlist from oracle database
how to get the values to dropdownlist from oracle database   </script> </head> <body> <select name... * from countryname"); while(rs.next()){ %> <option value="<
get values from Excel to database
get values from Excel to database   hi i want to insert values from Excel file into database.Whatever field and contents are there in excel file that should go to database which exists. am using SQL Server management studio
retaining textbox values
retaining textbox values  i have a calculator program, when i press a button the value displays but disappears when i press another button so how can i keep values to display when i press multiple buttons
how to get a values from processRecord - JSP-Servlet
how to get a values from processRecord  dear sir, i have a problem in getting a values from java to jsp.Here jsp is used to read a excel sheet that intern call a java program so i want a column values i.e a column contains
How to store extracted values from xml in a database? - XML
How to store extracted values from xml in a database?  I want to store extracted xml values in a database... How can i store extacted xml values in a database... give me a example
How to store extracted values from xml in a database? - XML
How to store extracted values from xml in a database?  I want to store extracted xml values in a database... How can i store extacted xml values in a database... give me a example
How to show autocomplete textbox values on combo box option selection using database?
How to show autocomplete textbox values on combo box option selection using database?  When I select option(i.e First Year) then it will show list of student names in auto-complete text box
How to access session values through Ajax?
How to access session values through Ajax?  Suppose in a servlet a variable userName is kept in session. How can I access this variable from JSP through AJAX? Is it possible
edit values of database using jsp
edit values of database using jsp  hi i want a code to edit the row from tye database and display in a page which containd radio buttons and drop down boxes using jsp code
 

 

 

DMCA.com