Home Answers Viewqa JSP-Interview-Questions read value from database & alert it is available in database or not

 
 


naveen
read value from database & alert it is available in database or not
1 Answer(s)      a year and 3 months ago
Posted in : JSP-Interview Questions

how to read value from text box and alert whether it is available in database or not?

View Answers

February 16, 2012 at 5:29 PM


1)availability.jsp:

<html>
<head>
<script type="text/javascript">
function check(value){ 
xmlHttp=GetXmlHttpObject()
var url="check.jsp";
url=url+"?name="+value;
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged(){ 
if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
    var showdata = xmlHttp.responseText; 
    document.getElementById("mydiv").innerHTML= showdata;
    } 
}
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 name="form">
 UserName: <input  type="text" name="name" id="name" onkeyup="check(this.value);"><font color="red"><div id="mydiv"></div></font>
</form>    

</body>
</html>

2)check.jsp:

<%@ page import="java.sql.*" %> 
<%
String name = request.getParameter("name").toString();
System.out.println(name);
String data ="";
try{
           Class.forName("com.mysql.jdbc.Driver");
           Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
           Statement st=con.createStatement();
           ResultSet rs=st.executeQuery("select * from login where username='"+name+"'");
int count=0;
          while(rs.next())
          {

                   count++;
          }

                    if(count>0)
          {
             data="Not Available";
          }
          else
          {
                      data="Available";
          }
out.println(data);
System.out.println(data);
}
catch (Exception e) {
System.out.println(e);
}
%>









Related Pages:
read value from database & alert it is available in database or not
read value from database & alert it is available in database or not  how to read value from text box and alert whether it is available in database...="text/javascript"> function check(value){ xmlHttp=GetXmlHttpObject() var
DATABASE
("Microsoft.XMLHTTP"); } if (xmlHttp==null){ alert("Browser does...="showState(this.value)"> <option value="none">Select</option>... = con.createStatement(); ResultSet rs = stmt.executeQuery("Select * from country"); while
Database
Database  from java code i have to retrieve some data from a database... in database timezone is 9PM 15APR2012. I want to retrieve something from database... will be able to retrieve data from database according to the database time. for example
database
user required data from the database and rank the results and display it to the user can you tell any real time application which is not currently available? can... that) based on that system search it to the database and rank the results and retrieve
database
database  How can i get combo box values from database?? or how... of combo box in java - from database? you had given me the answer <%@page...("Select * from country"); while(rs.next()){ %> <option value="<
database
database  i am created one table in mysql database with one... the email id from the user and check whether the given email id already exists or not. If it is already exist in database, then show a message 'Already exists
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...,serialno) values of excelsheet we have to compare with database value if these 3
Subtract a value in the database from java
Subtract a value in the database from java   Hi, i want to know how to subtract a value on a database. im using JDBC connection from access and i want to decrement the value of table "quantity" of 1 each time it passes a loop my
Alert in Servlet
Alert in Servlet  <p>Hi</p> <p>I want to delete record from oracle db, i need alert message saying 'Are you sure you want... from database"); stmt.close(); conn.close
Name Display in alert box - JSP-Servlet
Name Display in alert box  Dear Sir, Please any one help me......... when i enter some value in text that value is already in database display the alert box but the value is not in data base alert box is not display
related retrieving value from oracle database
related retrieving value from oracle database  how we get the value from database in the given textbox
code for insert the value from jsp to access database
code for insert the value from jsp to access database  code for insert the value from jsp to access database
related retrieving value from oracle database
related retrieving value from oracle database  how we get the value from database in the given textbox
jsp code for a drop down box to retrive value from database
jsp code for a drop down box to retrive value from database  my project needs to get the value from database in to the drop down box..... pls give me...=document.form.pass.value; if(username==""){ alert("Enter Username!"); return false
check radio button on retrieving the value from database.
check radio button on retrieving the value from database.  HI i am new to jsp.In my applcation i having a problem. I am retrieving user payment from... information from database the i want to show cash radio button checked.How can i do
Retrieve value of radio button from database to form
Retrieve value of radio button from database to form  var gn=document.getElementsByName("empg"); //empg is name of radio input type. for(var i=0;i
how to display data from database according to entered value in search field
how to display data from database according to entered value in search...("SELECT M.MEMBER_ID, M.FNAME,M.LNAME,M.AGE,B.HEIGHT,B.WEIGHT, B.BMI_VALUE FROM...(); System.out.println("Disconnected from database"); } catch (Exception e
JavaScript Alert YES NO
_alert('This will alert!')" value="Show alert box" string="alert for system...JavaScript Alert YES NO  How to send an alert to a user to confirm if there request is valid or not? I wants to send the alert message in Java Script
Drop down list from database
Drop down list from database  Hi, Can I know how do we get the drop down list from database? Eg: select country--select state--select district--so... * from country"); while(rs.next()){ %> <option value="<
Data retrieve from mysql database
("address").value!="-1"){ xmlHttp=GetXmlHttpObject() if (xmlHttp==null){ alert...(); alert("Please Select Employee Name"); document.getElementById("email").value...Data retrieve from mysql database  Hi sir, please give some example
java database
java database  help me with this...i never learn build java database... to design and implement objects needed for a program that maintains a database of students and teachers, and allows you to read in large files of student
Retrieving value from multiple table in database
Retrieving value from multiple table in database  Hi fnds, I want to maintain the financial database of 20 users for 1 year and update the details... FROM ( SELECT * FROM month1 UNION ALL SELECT * FROM month2 UNION ALL
Getting Textbox data from database
Getting Textbox data from database  When i m trying to get data in textbox as readonly from database i m getting following error.and my code is shown...;Here is a jsp code that retrieves data from database and display
change color according to the database value
change color according to the database value  any one know how to get values from database ( 1 or 0 ) and according to that change the color ( red or green) of given list
database
database  use of hyperlink to show the data from database
Read data from excel file and update database using jsp
Read data from excel file and update database using jsp  read data from excel file and update database using jsp Hi, I am using a MySQL database... upload excel file and update database using JSP ? Thanks in Advance
Accessing database from JSP
Accessing database from JSP   ... going to discuss the connectivity from MYSQL database with JSP.we take a example... or Accessing data from database: This is done using following code :- stmt
DATABASE
DATABASE  How can i get combo box values from database?? or how can i get values in the drop down menu of the html which is similar to dat of combo box in java - from database
Database
Database  How to represent data from database in a tree?   Please visit the following link: Retrieve data from database in tree using Java Swing
database
database  I wanted to know if it is possible to establish database connection on a remote pc with mysql using java swings from netbeans and then create a database on the remote pc.... Kindly help me
Database
Database  I am working in jsf2.Fro a demo i created database in ms access.no wi want to retrive a record from database for a particular data.I need help as I am stuck
DATABASE
DATABASE  I can't send different information from different form into a single table in my database
database
database  dateofbirth is not save into the database while i am enter from html browser.it shows as null.whats the reason
database
database  im doing my project in netbeans swings...wn a user wants to create a database from the gui...i want to display an error msg if a database with that name already exists and if it does not exist new database should
database
database  Can you please help me to establish database connection to ms sql 2000 from java swing in netbeans
database
database  i need optimised searching algorithm to retrieve the data from the database and optimised ranking algorithm to display the reults into the user
database
database  I want to let the user select one of the database type(mysql,ms sql or db2) from the combo box present on the swing gui and then let him give the name of the database name that he want to create in a textfield
Database Designing
Database Designing       There are some rules are available for designing the database... multiple value store  and singular column names . MySQL Database Normalization
Database
Database   select * from student i am not asking this.i am asking about that the command line code like create table student(..........) like this way
database
database  I wanted to know if it is possible to take the fields of a table from a user and then create a table in mysql database......im doing my project in swings netbeans Plz help me ThankYou
Database
Database  is it possible to view the query code after executing it.if yes tell me the procedure.   Yes, if you want to retrieve the data that is stored in database, then use the given query: select * from student
select value from autocomplete textbox using jquery in jsp from database.
select value from autocomplete textbox using jquery in jsp from database.  Hii Sir, Lots of thnx to ur reply .I went through both... of selecting value from autocomplete textbox using jquery in jsp from mysql database
select value from autocomplete textbox using jquery in jsp from database.
select value from autocomplete textbox using jquery in jsp from database. ... but was unable to find out exact way to fullfill the solution of selecting value from autocomplete textbox using jquery in jsp from mysql database. Kindly send me
Update value of database using hibernate.
Update value of database using hibernate.  How to update value of database using hibernate?   Hibernate provides facility to update... as salary0_0_ from employee employee0_ where employee0_.emp_id=? Updated Description
database
that fetches the information from the database and display it on the console. The given code retrieve table names and their fields from the particular database...database  how to get information about database like, what
Serializing Objects Into Database - java tutorials
read the binary stream again, and the database contained a SQL NULL, you get...Serializing Objects Into Database 2001-05-24 The Java Specialists' Newsletter [Issue 020] - Serializing Objects Into Database Author: Dr. Heinz M
Database
Database  hi i don't know any thing about database please help me and explain it for me . thank you   you can get more data base programs from here View Programs here
database
database  how to search data from database using jsp & how to rank the searched result using any searching algorithm   Please visit the following links: http://www.roseindia.net/jsp/user-search.shtml http
selecting data from database
selecting data from database  how to select data from database using Dao in struts   Hi, You have to load the data from database using hibernate and send the data in a Java file object to jsp page. Please read at http
Database
Database  Hi, i need help building a database based on something like...), multiplicity (or cardinality), in the context of the database system (i.e. give... the database, create and populate tables, query individual tables. (You must

Ask Questions?

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.