Home Answers Viewqa Java-Beginners java server side validations

 
 


pavan
java server side validations
1 Answer(s)      3 years and 6 months ago
Posted in : Java Beginners

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 Pages:
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
validations
validations  How to get All Client and server side validations in spring using jsp   Please visit the following link: Spring Validation Example
java validations
java validations  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01...="images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>... rowspan="3" class="sized"><img src="images/shared/side_shadowright.jpg
Struts Validations - Framework
Struts Validations  What is the server-side validations exactly? give me on example
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
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
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 scripting in php
server side scripting in php  is it possible to access values on server side in post request PHP
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
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 ASAP Thanks
session variables server side
session variables server side  how to hold session variable for server side..?   request.getSession().setAttribute("wellSelection", uid
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 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
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
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
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
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
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
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
validations in struts - Struts
validations in struts  hi friends plz give me the solution its urgent 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
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
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
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
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 pages Here
Chat Server
-application, server application (which runs on server side) and client application...;  Server Side Application   Client Side Application  ... Chat Server      
Application Server : Java Glossary
Application Server : Java Glossary       An Application server is a server side program that is used... based applications uses application servers. Application server are developed
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 steps Firstly creates a new server socket
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
Struts 2 Validation
server side validations. Struts 2.0 action relies on the XWork validation framework... validations are integral part of any web application. With the release of Struts 2... using Java 5 annotations.  Struts 2 Validation (Int Validator) Struts 2
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...(); } } After that write a xml file for server side validation. The naming
importing client side web history
importing client side web history  Hello, i am just trying to import the web history of client in lan through java.... can u plz help me
i want to create website,with manu with three level submenu on top side of page please send me code java
i want to create website,with manu with three level submenu on top side of page please send me code java   iam createing wibsite thats using eclipse andtomcat server,please help me to write menu with three level submenu
chat server in java - JavaMail
chat server in java  sir i was ask u question related to the chat server,and you has given a answer,but sir i want to make a network based chat server ,in network base chat server ,there is no use of the AWT,SWING,in server side
validations in javascript
validations in javascript  How do you check validations in javascript
What is Java Servlets?
; Servlets are server side components that provide a powerful mechanism for developing server side programs. Servlets provide component-based, platform-independent... create fast and efficient server side application which can run on any servlet
Advantages of Servlets over CGI
java servlets provide excellent framework for server side processing. Using...;  Servlets are server side components that provides a powerful mechanism for developing server web applications for server side. Earlier CGI was developed
Client Side Coding
, or in server side or in both scripts. Usually a user interface program is scripted... Client Side Coding       Here, the client side coding refers to the code scripted for the end
Server Sockets
the client side connection and second is server socket, which implement the server side connection. In Java there are many socket class that is used... program and a server program. In java there is a java.net package, which
Life Cycle of Java Server Faces
when validations, conversions, and events are usually handled during the life
validations - Struts
validations  log in page with validations user name must be special character and one number and remining is alphabetes in struts
ServletContext
are server side components that provide a powerful mechanism for developing server side programs. It is a small program that runs on a server. Servlets provide... allows a programmer to add dynamic content to a Web server using the Java platform
Introduction to Java Servlets
Java Servlets are server side Java programs that require...; As seen earlier, Java servlets are server side programs or to be more specific... include Java Server Pages (JSPs) and Enterprise Java Beans (EJBs
Introduction to the JSP Java Server Pages
. Introduction to JSP Java Server Pages or JSP for short is Sun's solution for developing dynamic web sites. JSP provide excellent server side...; JSP Tutorials - Introducing Java Server Pages Technology
Open Source E-mail Server
Open Source E-mail Server MailWasher Server Open Source MailWasher Server is an open-source, server-side junk mail filter package... making its Java Enterprise System server software open-source, John Loiacono
Introduction to JSF
JSF is a server side UI based MVC Framework for building Java based web application

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.