Name Displaying

Ads

 
 
 

Share on Google+Share on Google+

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

May 17, 2008 at 7:09 PM


Hi

<!DOCTYPE HTML PUBLIC ?-//W3C//DTD HTML 4.01 Transitional//EN?>
<html>
<head>
<title>AJAX and Servlet</title>
<script language="javascript">
var xmlHttp;
function checkUserExist(){
var username = document.getElementById("username").value;
var url = "AJAXCheckUserServlet?username=" + username;
if(window.XMLHttpRequest){
xmlHttp = new XMLHttpRequest();
}
else if(window.ActiveXObject){
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlHttp.open("Get",url,true);
xmlHttp.onreadystatechange = callback;
xmlHttp.send(null);
}
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( );
}
</script>
</head>
<body onload="focusIn();">
<form>
User Name <input type="text" id="username" name="username"/>
<input type="button" value="Check User Name Availability" onClick="checkUserExist()"/>
<div id="text"></div>
</form>
</body>
</html>

----------------------------------

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

<%
Connection con = null;
String url = "jdbc:mysql://192.168.10.211:3306/";;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
String user ="amar";
String pass = "amar123";
boolean isExist= false;
try{
Class.forName(driver).newInstance();
con = DriverManager.getConnection(url+db, user, pass);
try{
Statement st = con.createStatement();
String username = request.getParameter("user_name");
ResultSet res = st.executeQuery("SELECT user_name FROM user");
while (res.next()) {
String un = res.getString("user_name");
if(username.equals(un)){
con.close();
isExist = true;
break;
}
}
con.close();
}
catch (SQLException s){
System.out.println("SQL code does not execute.");
}
}
catch (Exception e){
e.printStackTrace();
}
%>

------------------------------------------

Read for more information.

http://www.javajazzup.com/issue10/page21.shtml


Ads









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
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
Advertisements
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
image displaying in java
image displaying in java  how to display an image by using load image button in applet viewer
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
(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 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 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
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
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
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 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
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 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 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
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
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
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
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
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
class name
class name  what is the class name of circle.java   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
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 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" />
Displaying Error pages in results tree in jmeter
Displaying Error pages in results tree in jmeter   Displaying Error pages in results tree in jmeter
Tutorials   
Java Spring Hibernate Struts Training fat image from db fat image from db fat image from db fat image from db unable to get value returned from javascript variable in page How to change image size before adding to mysql using jsp Design a registration.jsp page with input for user registration details Cart Quantity jsp servlet coding issue servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? image pdf marking pdf marking Multiple image upload using JSP Read code from excel sheet and upload into database using JSP Student java about search engine Convert BLOB to PDF and save it to a location how to copy files from remote to local machine using SFTP SSL in java? Like Team viewer Socket and Servert -Jsp how to copy files from remote location to local using java? How To Store Multilple Images In MySQL database dynamically with image uploader and then retrieve them in image gallery using java how to create SOAP based web service in java? how to fetch data from mysql database table and draw a bar chart on that data using in jsp how to create users in LDAP using java? how to authenticate user using TIVOLI api in java? how to create users using IBM Tivoi API in jsp/servelet? Java/J2ee Please explain this code as many packages and classes are unknown to me .! how to download the uploaded folder files using jsp Login Query image is display from path of mysql database please reply the code to store dynamic fields in database? Reloading issue in jsp How to get Button Id ? calling one jap page from another jsp page login login Problem to get connection from DAO class to JDBC Page Loading Time Fix table's column's name row(1st row of the table) so that it does not move up when the table is scrolled up to view more rows below Sending hidden values

Ads

 
Advertisement null

Ads