java server side validations

java server side validations

View Answers

November 27, 2009 at 5:16 PM

Hi Friend,

we are providing you a simple swing application to validate for unique username using MySql database.

import javax.swing.*;
import java.awt.*;
import java.sql.*;
import java.awt.event.*;
class CreateAccount extends JFrame{
JTextField text1,text2,text3,text4,text5;
JPasswordField pass1;
JLabel label1,label2,label3,label4,label5,label6;
JPanel panel;
JButton button,button1;
CreateAccount() {
text1=new JTextField(15);
text2=new JTextField(15);
text3=new JTextField(15);
pass1=new JPasswordField(15);
text4=new JTextField(15);
text5=new JTextField(15);
label1=new JLabel("First Name");
label2=new JLabel("Last Name");
label3=new JLabel("User Name");
label4=new JLabel("Password");
label5=new JLabel("Address");
label6=new JLabel("Phone No");
button=new JButton("Save");
panel=new JPanel(new GridLayout(7,2));
panel.add(label1);
panel.add(text1);
panel.add(label2);
panel.add(text2);
panel.add(label3);
panel.add(text3);
panel.add(label4);
panel.add(pass1);
panel.add(label5);
panel.add(text4);
panel.add(label6);
panel.add(text5);
panel.add(button);
panel.add(button1);
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
String value1=text1.getText();
String value2=text2.getText();
String value3=text3.getText();
String value4=pass1.getText();
String value5=text4.getText();
String value6=text5.getText();

Connection con = null;
String url = "jdbc:mysql://localhost:3306/";;
String db = "test";
String driver = "com.mysql.jdbc.Driver";
String user = "root";
String pass = "root";
String user1="";
String pass1="";
try{
Class.forName(driver);
con = DriverManager.getConnection(url+db, user, pass);
Statement st = con.createStatement();
ResultSet rs=st.executeQuery("Select * from login where username='"+value3+"'");
String usern="";
if(rs.next()){
usern=rs.getString("username");
JOptionPane.showMessageDialog(null,"Invalid UserName");
}
else {

int k=st.executeUpdate("insert into login(firstname,lastname,username,password,address,contactno) values('"+value1+"','"+value2+"','"+value3+"','"+value4+"','"+value5+"','"+value6+"')");
JOptionPane.showMessageDialog(null,"Data is successfully saved");
}

}
catch(Exception e){}
}
});
add(panel);
setSize(300,400);
setVisible(true);
}
public static void main(String[]args){
CreateAccount acc=new CreateAccount();
}


}
Hope that it will be helpful for you.
Thanks









Related Tutorials/Questions & Answers:
java server side validations - Java Beginners
java server side validations  how to write the server side validation for unique username in java? please help me   Hi Friend, we are providing you a simple swing application to validate for unique username using
server side scripting java - JSP-Servlet
server side scripting java  I Very new to java server pages I am doing a project in java messaging service so in that i have a client on d server... on the server side i want that in the client side as pop up window
Advertisements
validations
validations  How to get All Client and server side validations in spring using jsp   Please visit the following link: Spring Validation Example
server side scripting in php
server side scripting in php  is it possible to access values on server side in post request PHP
how to perform the client side validations to the dropdown list using javascript?
how to perform the client side validations to the dropdown list using javascript?  Hi Good Morning! This is Prasad, I want to perform the client side validation to the dropdown list using javascript. So give me sample.I am
Server side validation vs client side validation
Server side validation vs client side validation  Can any one tell me... of Server side validation vs client side validation.   The client side validation runs in the browser where as server side validation runs on server
server-side inclusions in xml
server-side inclusions in xml  Hi... Can I still use server-side inclusions in xml? please tell me about that ASAPADS_TO_REPLACE_1 Thanks
java validations
java validations  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01...; if (f.length<20) { alert("Address too short"); return false; } var q=document.retailer.contact_no.value; if (q==null || q=="") { alert
session variables server side
session variables server side  how to hold session variable for server side..?   request.getSession().setAttribute("wellSelection", uid
Hi i want java code that diaplays server scren at the client side
Hi i want java code that diaplays server scren at the client side  Hi I'm Shivaprasad i want java socket code that shows the server side screen when client gets connected with the server. Please help me   Please visit
Difficulty using javascript in server side - Java Interview Questions
Difficulty using javascript in server side   why interaction with server using javascript is difficult
server side validation in struts
server side validation in struts  Hello sir, i want to do server side validation in struts based on 3 fields. those 3 field are BatchNo,LotNo,StepNo.Here we can have the same batchno,lotno for different forms
Server side Paging in jsp ?
Server side Paging in jsp ?  Hi i am student of It . i am learning jsp-servlet and i am trying to do paging in my report generation but i want to do server side paging and i am using oracle 10g in back end . it will be very
Client Side and Server Side coding
Client Side and Server Side coding       The combo of client side and server side coding... to write code in both client side and server side. Some other combinations are &ndash
What do you think about client-side/server-side coding ?
What do you think about client-side/server-side coding ?  Hi, What do you think about client-side/server-side coding
Server Side Coding
Server Side Coding       Server Side Coding, on the other hand is the script that does...-side script cannot run and it will also not support the client-side script. Server
Struts Validations - Framework
Struts Validations  What is the server-side validations exactly? give me on example
ModuleNotFoundError: No module named 'django-server-side-matomo'
ModuleNotFoundError: No module named 'django-server-side-matomo'  Hi...: No module named 'django-server-side-matomo' How to remove the ModuleNotFoundError: No module named 'django-server-side-matomo' error? Thanks  
ModuleNotFoundError: No module named 'django-server-side-piwik'
ModuleNotFoundError: No module named 'django-server-side-piwik'  Hi...: No module named 'django-server-side-piwik' How to remove the ModuleNotFoundError: No module named 'django-server-side-piwik' error? Thanks  
which server side script used in j2ee - Ajax
which server side script used in j2ee  Which server-side script... scenario you have to call the server side script? Thanks... to, and processes the data.  Hi, You can use ajax in JavaScript to talk to server
reading a file on server side - JSP-Servlet
reading a file on server side  Thank you sir for replying with the solution of my first question. Now i am facing some problem in renameing & reading a word file in JSP which is uploaded by client. please help me
Server Side Application
Server Side Application       Server side application is used to get the message.... The Server side application follows these stepsADS_TO_REPLACE_1 Firstly creates
how a write a server side progranming in j2sdk for j2me application
how a write a server side progranming in j2sdk for j2me application  ... Server type. so,i want to ask you, 1)How i am establish Msoffice Database connectivity. 2)How do i write a server side(servlet)program in j2me
validations in javascript
validations in javascript  How do you check validations in javascript
Introduction to Server Side Programming
Introduction to Server Side Programming   .... Why Server Side Programming? Though it is technically... is ? ?Server Side Programming?. Figure-1 illustrates Server side architecture
EasyEclipse Server Java
EasyEclipse Server Java       EasyEclipse Server Java For development of server-side... servers (Tomcat, JBoss, WebLogic), develop on some server-side frameworks (Struts
validations - Struts
validations  log in page with validations user name must be special character and one number and remining is alphabetes in struts
Spring Validations
Spring Validations  Hi.. i need code for validations using spring annotations
Server side validation on dynamically generated fields from more than one table on spring framework.
Server side validation on dynamically generated fields from more than one table on spring framework.   Server side validation on dynamically generated fields from more than one table in spring mvc framework
Is JSP a client side scripting language?
Is JSP a client side scripting language?  Is Java Server Pages(JSP) is a client side language or server side scripting language? Also what is JSF
Maven dependency for io.swagger - swagger-hibernate-validations version 1.6.9 is released. Learn to use swagger-hibernate-validations version 1.6.9 in Maven based Java projects
-hibernate-validations version 1.6.9 ) in their Java project if it is based...-validations version 1.6.9 in Java projects. Follow the step by step tutorial for using...; io.swagger - swagger-hibernate-validations version 1.6.9 java library in your
Maven dependency for io.swagger - swagger-hibernate-validations version 1.6.9 is released. Learn to use swagger-hibernate-validations version 1.6.9 in Maven based Java projects
-hibernate-validations version 1.6.9 ) in their Java project if it is based...-validations version 1.6.9 in Java projects. Follow the step by step tutorial for using...; io.swagger - swagger-hibernate-validations version 1.6.9 java library in your
Maven dependency for io.swagger - swagger-hibernate-validations version 1.6.7 is released. Learn to use swagger-hibernate-validations version 1.6.7 in Maven based Java projects
-hibernate-validations version 1.6.7 ) in their Java project if it is based...-validations version 1.6.7 in Java projects. Follow the step by step tutorial for using...; io.swagger - swagger-hibernate-validations version 1.6.7 java library in your
Maven dependency for io.swagger - swagger-hibernate-validations version 1.6.8 is released. Learn to use swagger-hibernate-validations version 1.6.8 in Maven based Java projects
-hibernate-validations version 1.6.8 ) in their Java project if it is based...-validations version 1.6.8 in Java projects. Follow the step by step tutorial for using...; io.swagger - swagger-hibernate-validations version 1.6.8 java library in your
Maven dependency for io.swagger - swagger-hibernate-validations version 1.6.6 is released. Learn to use swagger-hibernate-validations version 1.6.6 in Maven based Java projects
-hibernate-validations version 1.6.6 ) in their Java project if it is based...-validations version 1.6.6 in Java projects. Follow the step by step tutorial for using...; io.swagger - swagger-hibernate-validations version 1.6.6 java library in your
Maven dependency for io.swagger - swagger-hibernate-validations version 1.6.5 is released. Learn to use swagger-hibernate-validations version 1.6.5 in Maven based Java projects
-hibernate-validations version 1.6.5 ) in their Java project if it is based...-validations version 1.6.5 in Java projects. Follow the step by step tutorial for using...; io.swagger - swagger-hibernate-validations version 1.6.5 java library in your
Maven dependency for io.swagger - swagger-hibernate-validations version 1.6.4 is released. Learn to use swagger-hibernate-validations version 1.6.4 in Maven based Java projects
-hibernate-validations version 1.6.4 ) in their Java project if it is based...-validations version 1.6.4 in Java projects. Follow the step by step tutorial for using...; io.swagger - swagger-hibernate-validations version 1.6.4 java library in your
Maven dependency for io.swagger - swagger-hibernate-validations version 1.6.3 is released. Learn to use swagger-hibernate-validations version 1.6.3 in Maven based Java projects
-hibernate-validations version 1.6.3 ) in their Java project if it is based...-validations version 1.6.3 in Java projects. Follow the step by step tutorial for using...; io.swagger - swagger-hibernate-validations version 1.6.3 java library in your
Maven dependency for io.swagger - swagger-hibernate-validations version 1.5.3 is released. Learn to use swagger-hibernate-validations version 1.5.3 in Maven based Java projects
- swagger-hibernate-validations version 1.5.3 ) in their Java project if it is based...-validations version 1.5.3 in Java projects. Follow the step by step tutorial...-hibernate-validations released The developers of   io.swagger - swagger
Maven dependency for io.swagger - swagger-hibernate-validations version 1.5.17 is released. Learn to use swagger-hibernate-validations version 1.5.17 in Maven based Java projects
- swagger-hibernate-validations version 1.5.17 ) in their Java project...-hibernate-validations version 1.5.17 in Java projects. Follow the step by step...-validations version 1.5.17 java library in your project. ADS_TO_REPLACE_2 Now you can
Maven dependency for io.swagger - swagger-hibernate-validations version 1.5.23 is released. Learn to use swagger-hibernate-validations version 1.5.23 in Maven based Java projects
- swagger-hibernate-validations version 1.5.23 ) in their Java project...-hibernate-validations version 1.5.23 in Java projects. Follow the step by step...-validations version 1.5.23 java library in your project. ADS_TO_REPLACE_2 Now you can
Server side Validation
Server Side Validation It is very important to validate the data coming from the client side, so that wrong data could not process into the application... for server side validation. The naming convension for writing this aml file is it should
Custom Validations - Struts
Custom Validations  Hi, I am trying to do the custom validations in struts 1.1.That is how can we plug in our own custom validations.../tutorialsearch/?t=server%20side%20validations%20using%20struts1.2 Thanks
Validations
Validations
struts validations - Struts
struts validations  hi friends i an getting an error in tomcat while running the application in struts validations the error in server as validation disabled plz give me reply as soon as possible.  Hi friend
Client Side validation in Struts 2 application
that will generate Java Script code for client side validation. In the last section we developed Login-validator.xml configuration file for defining the server side... for generating the client side java script.   Developing JSP pagesADS
Not retriving the validations from validation.xml - Struts
Not retriving the validations from validation.xml  I have create the file called register.jsp... to this validation for client side when i was see the clientside validation
ModuleNotFoundError: No module named 'validations'
ModuleNotFoundError: No module named 'validations'  Hi, My Python... 'validations' How to remove the ModuleNotFoundError: No module named 'validations' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'validations'
ModuleNotFoundError: No module named 'validations'  Hi, My Python... 'validations' How to remove the ModuleNotFoundError: No module named 'validations' error? Thanks   Hi, In your python environment

Ads