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



Home Answers Viewqa JSP-Servlet Name Displaying

Have Programming Question? Ask it here!
 
 
 


vijayababu
Name Displaying
1 Answer(s)      6 years ago
Posted in : JSP-Servlet



Advertisement
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



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
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 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
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 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
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 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
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 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
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" />
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 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" />
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 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
Displaying Error pages in results tree in jmeter
Displaying Error pages in results tree in jmeter   Displaying Error pages in results tree in jmeter
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
Displaying calendars - Java Interview Questions
Displaying calendars  Write a program that prompts the user to enter the year and first day of the year, and displays the calendar table for the year on the console. For example, if the user entered the year 2005, and 6
displaying image in awt - Java Beginners
displaying image in awt  Hi All, I have downloaded the code to display image using awt from here and when I execute the code I am getting error like: D:\netbeans\myjavaappl\src\ImageDemo.java:21: incompatible types
displaying data from ms excel in form.
displaying data from ms excel in form.  Hi all, I have a requirement as mentioned below: Requirement: I have stored some data in the ms excel. In one of the column i am also storing the name of a pic file.. say image.jpg
reading and displaying svg file through java
reading and displaying svg file through java  sample program for reading a svg file
displaying images and records problem - JSP-Servlet
displaying images and records problem  hi, Thanks for your reply to my question. The code you sent to me last week is not working. it doesn't... database is: emp_id int; picture blob; first_name varchar(50); last_name
Displaying Hello World using GWT
Displaying Hello World using GWT       This example describes the process for displaying... involved in displaying the Hello World message using Net Beans IDE 6.1
displaying long size arrow line in a jsp
displaying long size arrow line in a jsp  Hi all, How can we display an arrow mark with a specified height and width in a jsp. Please help me in resolving this problem. Thanks, Suresh
web page altering while displaying servlet response
web page altering while displaying servlet response  in my application one index.jsp and one servlet is there and the servlet contains some db code...(request, response); i have used this code but it is not displaying the page
image displaying from database with some other information
image displaying from database with some other information  hi, in the following section of code when i am not displaying the image it is working...; <th width="146" scope="col"> <input type="hidden" name
Displaying data from combobox on the web page
Displaying data from combobox on the web page  Sir, I have to make a project in which a data from the database is to be displayed in combo box and depending on the choice made in combo box the data pertaining to it from
Displaying data from combobox on the web page
Displaying data from combobox on the web page  Sir, I have to make a project in which a data from the database is to be displayed in combo box and depending on the choice made in combo box the data pertaining to it from
Displaying data from combobox on the web page
Displaying data from combobox on the web page  Sir, I have to make a project in which a data from the database is to be displayed in combo box and depending on the choice made in combo box the data pertaining to it from
Displaying data from combobox on the web page
Displaying data from combobox on the web page  Sir, I have to make a project in which a data from the database is to be displayed in combo box and depending on the choice made in combo box the data pertaining to it from
Displaying data from combobox on the web page
Displaying data from combobox on the web page  Sir, I have to make a project in which a data from the database is to be displayed in combo box and depending on the choice made in combo box the data pertaining to it from
validating credentials and displaying error message in login .jsp if not valid
validating credentials and displaying error message in login .jsp if not valid  hi, i want to validate user name and password against my database table if not valid i have to display error message in my login page.how to do
jsp programe for displaying data from database
jsp programe for displaying data from database  i am using JSP.i want...; <table> <tr><td>Enter Name:</td><td><input type...(); stmt.executeUpdate("insert into data(name,address,email) values('"+val1+"','"+val2+"','"+val3
jsp programe for displaying data from database
jsp programe for displaying data from database  i am using JSP.i want...; <table> <tr><td>Enter Name:</td><td><input type...(); stmt.executeUpdate("insert into data(name,address,email) values('"+val1+"','"+val2+"','"+val3
Advertisements
 

 

 

DMCA.com