Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  

Name Displaying



Share on Google+Share on Google+

Name Displaying
1 Answer(s)      9 years ago
Posted in : JSP-Servlet
View Answers

May 17, 2008 at 7:09 PM


<!DOCTYPE HTML PUBLIC ?-//W3C//DTD HTML 4.01 Transitional//EN?>
<title>AJAX and Servlet</title>
<script language="javascript">
var xmlHttp;
function checkUserExist(){
var username = document.getElementById("username").value;
var url = "AJAXCheckUserServlet?username=" + username;
xmlHttp = new XMLHttpRequest();
else if(window.ActiveXObject){
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlHttp.onreadystatechange = callback;
function callback() {
if( xmlHttp.readyState==4 ){
if( xmlHttp.status==200 ) {
document.getElementById('text').innerHTML = "<br/><b>"+xmlHttp.responseText+"</b>";
function focusIn(){
document.getElementById("username").focus( );
<body onload="focusIn();">
User Name <input type="text" id="username" name="username"/>
<input type="button" value="Check User Name Availability" onClick="checkUserExist()"/>
<div id="text"></div>


<%@ page language="java" import="java.sql.*,java.util.*,java.text.*" %>

Connection con = null;
String url = "jdbc:mysql://";;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
String user ="amar";
String pass = "amar123";
boolean isExist= false;
con = DriverManager.getConnection(url+db, user, pass);
Statement st = con.createStatement();
String username = request.getParameter("user_name");
ResultSet res = st.executeQuery("SELECT user_name FROM user");
while ( {
String un = res.getString("user_name");
isExist = true;
catch (SQLException s){
System.out.println("SQL code does not execute.");
catch (Exception e){


Read for more information.


Related Tutorials/Questions & Answers:
Name Displaying - JSP-Servlet
Name Displaying  Dear Sir, Please any one help me......... when i enter some value in text that value is already in database dispaly the alert...( ); } User Name
Name  make a program that take a input from user in alphabet and show all the name of that character E.g User give character "B". The program shows all the human names which starts from B.   Java show all names
displaying data
displaying data   how to display data from database on jsp using struts2
displaying image
displaying image  how to upload image and retrieve it form database...="box"> <tr> <td width="246"> <input type="hidden" name="MAX_FILE_SIZE" value="2000000"> <input name="userfile" type="file" id="userfile">
Image is not displaying
Image is not displaying  Hii i am using spring javamail with html template to send mail,i am facing that image displaying prob when mail have to cm in gmail,in template just i am giving my current location of image which
autocomplete displaying multiple fields
autocomplete displaying multiple fields  How can I create an autocomplete with three field (name, id, phone). Placing the phone field in the appropriate input field but selecting the name field into the 'calling' input box
PHP Displaying URL Content
PHP Displaying URL Content  In my PHP application form, on submitting the form details it always displaying url content. Can anyone tell me what is the reason and how to restrict it from displaying
codes for displaying in calendar
codes for displaying in calendar  can i get jsp codes for displaying comments, when the pointer is placed over the particular date in calendar
Displaying images - JDBC
Displaying images  How to display multiple images on a single jsp from MySql database
Displaying images - JDBC
Displaying images  How to display multiple images on a single jsp from MySql database
image displaying in java
image displaying in java  how to display an image by using load image button in applet viewer
Displaying Date in jsp - JDBC
Displaying Date in jsp  I want to insert Date of birth of a person...("Please enter User Name!"); theForm.userid.focus(); return false... User Name: Address
(Displaying a calendar in GUI
(Displaying a calendar in GUI  (Displaying a calendar) Write a program that displays the calendar for the current month, as Use labels, and set texts on the labels to display the calendar."The Calendar and GregorianCalendar
Displaying error on the Same form
Displaying error on the Same form  I want to display the errors... validate(){ var n=document.getElementById("name").value; var a=document.getElementById... Name!</font>"; return false; } if(a==""){ document.getElementById("lab
Uploading a software and displaying it on the jsp page
Uploading a software and displaying it on the jsp page  I have a Downloads page in my website, I want it to display the name of softwares as soon as it is uploaded in the backend by the administrator. And the admin may be a non
Displaying Rows - JSP-Servlet
Displaying Rows  Hi, I need your support on how to display data from... Name... = con.createStatement(); String firstname=request.getParameter("name"); String
Displaying files on selection of date.
Displaying files on selection of date.  Hi, I am developing a GUI, where i select from and to date. On selection of from and to date the GUI should..._name,dateOfFile from myfile where dateOfFile between '"+d1+"' and '"+d2
xml displaying a drives data.....
xml displaying a drives data.....  Hi all, I need a solution for displaying content of a drive(Ex: c , d , e ) in the browser using the XML... a solution for displaying content of a drive(Ex: c , d , e ) in the browser using
displaying a physical webpage with frames in iframe
displaying a physical webpage with frames in iframe  i have iframe...;% String path=request.getParameter("name"); File directory = new File(path...[index].getAbsolutePath(); %> <a href="fileview?name=<%=s1%>" target
Displaying database values in pdf format
Displaying database values in pdf format  Hi All, I am developing a struts application.I am having one registration form when i am submitting the form the values are stored in database,the database name is registration
Displaying date in the preciding code
Displaying date in the preciding code  while deploying the Bill date field on this page are empty though it should be displayed String userName = request.getParmeter("userName"); String custId = request.getParameter("customerId
displaying in ajax - Ajax
displaying in ajax  hi.. I have an Ajax page ,request gone to server ana details are bought... the response should be displayed in the same request page not in the other page... Thank u.. I will be waiting
Name unique
Name unique  I want to check whether the value which I give for the name textfield already exists in the database. In case if it exists , it should.... In other words, value for the name should be unique
Displaying file from database
Displaying file from database  I have list of files in my database. I want to display these files in browser according to the input. My need is like google search result. when i click on the link it should display
search for a name
search for a name  Search for a name Write a program to accept an array of names and a name and check whether the name is present in the array. Return the count of occurrence. Use the following array as input {?Dave?, ?Ann
class name
class name  what is the class name of   how do i complie my jdk file, what happen s if i put in the correct commands and it still does not complie, what do i do next
Displaying image using jsp and spring.
Displaying image using jsp and spring.  how to display an image stored in WEB-INF/images folder on the browser using jsp and spring
Displaying java.util.Calendar using JSP struts tags
Displaying java.util.Calendar using JSP struts tags  My question is in regard to displaying a date whose source is java.util.Calendar... and display it as <s:date name="todayDate" format="yyyy-MM-dd" />
Data displaying with limited records in jsp
Data displaying with limited records in jsp  How to display table with limited 10 records , after clicking next button another 10 records from database upto last record please help me
JSP - Problem of displaying result at webpage
JSP - Problem of displaying result at webpage  Can anyone please help to solve my problem below. My webpage has problem in displaying result position... <input name="ADSLNO" type="text" />
displaying employee records and their images problem - JSP-Servlet
displaying employee records and their images problem  hi, Thanks for your reply to my question. The code you sent to me yesterday..._name varchar(50); last_name varchar(50); department varchar(50