login-password

login-password

View Answers

September 13, 2008 at 10:59 AM

Hi friend,

<html>
<title>login application in jsp</title>
<head>

<script type="text/javascript">

function validateForm(theForm){



if(theForm.userid.value==""){

//Please enter username

alert("Please enter User Name.");

theForm.userid.focus();

return false;

}
if(theForm.password.value==""){
//please enter passward
alert("Please enter Password.");
theForm.password.focus();
return false;
}

return true;
}
</script>
</head>

<body>
<br>
<br/>
<center>

<table border="1" width="400px" bgcolor="pink" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<form method="POST" action="loginAction.jsp" onsubmit="return validateForm(this);">

<h2 align="center"><font color="red">Login Application in JSP</font></h2>
<table border="0" width="350px" cellspacing="2" cellpadding="4">
<tr>
<td width="50%"><b>User Name:</b></td>
<td width="50%"><input type="text" name="userid" size="20"/> </td>
</tr>
<tr>
<td width="50%"><b>Password:</b></td>
<td width="50%"><input type="password" name="password" size="20"/> </td>
</tr>

</table>
<center>
<p><input type="submit" value="Submit" name="submit">
<input type="reset" value="Reset" name="reset"></p>
</center>
</form>
</td>
</tr>
</table>
</center>
</body>

</html>

September 13, 2008 at 11:02 AM

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


<%



String userid = request.getParameter("userid");

String password = request.getParameter("password");



Connection con = null;
String url = "jdbc:mysql://192.168.10.211:3306/";;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
String userName ="amar";
String pass="amar123";

try {

Class.forName(driver);
con = DriverManager.getConnection(url+db,userName,pass);

Statement st = con.createStatement();

String strQuery = "select * from login where userid='"+userid+"' and password='"+password+"'";

out.println(strQuery);

ResultSet rs = st.executeQuery(strQuery);



while(rs.next()){

if((rs.getString(1).equals("admin")) && (rs.getString(2).equals("admin")))

{

session.setAttribute("userid",userid);

response.sendRedirect("userForm.jsp");
}


if((rs.getString(1).equals("user")) && (rs.getString(2).equals("user")))

{

session.setAttribute("userid",userid);

response.sendRedirect("registrationForm.jsp");
}

else{

response.sendRedirect("loginForm.jsp");

}


}

System.out.println("Connected to the database");

con.close();



} catch (Exception e) {

e.printStackTrace();

}

%>

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

Visit for more information.

http://www.roseindia.net/jsp/bank.shtml

Thanks & Regards

Amardeep









Related Tutorials/Questions & Answers:
login-password - Java Beginners
login-password  complete code of login-password form then how to connect the bank simulation project?   Hi friend, login...; } if(theForm.password.value==""){ //please enter passward alert("Please enter Password
Login Password Validation iPhone / iPAD
Login Password Validation iPhone / iPAD  HOW TO WRITE A TEST CASE TO SET THE VALIDATION FOR LOGIN AND PASSWORD FIELD IN OBJECTIVE C, IOS.   @implementation LoginViewTests - (void)testPasswordFieldIsNotEmpty
Advertisements
PHP User Authentication Login and password check Tutorial
to the database. $dbname="name"; #Password to verify its you. $dbpass="
password check
password check  how to check sighup passowrd and login password
java - Java Beginners
java  hi, I need the coding for encoding the login password using MD5 algorithm. please help me as soon as possible. Regards, Valarmathi
SQL and JSP
SQL and JSP  1.sql database 1.store login and password details along with user name 2.list of employees with all relevant personal details... and password entry box.the user id and password entered will be evaluated
HQL Query in execute method of Struts2
HQL Query in execute method of Struts2  I am making login page in struts2 and using hibernate . Now I wants to pull user name and password from database and match the login password given by user. But I am not able to fetch
Spring Login Page Error
Spring Login Page Error  Dear Sir/Madam, I used the spring login page code. The index page is working fine. When i try to entry login and password , i am getting the below error: Please help me out in this. Let me know if i
Email sending in jsp - JSP-Servlet
Login Password Back-end coding: EmailServlet.java... = request.getParameter("login"); String password = request.getParameter("password..."); Authenticator auth = new SMTPAuthenticator(login, password
sessions management
sessions management  I have a problem with the session management of my applcation deployed in tomcat. in fact, my application allows only one session to a login / password given. I then add in the database a flag for each user
Log In Form Validations - Java Beginners
)) { JOptionPane.showMessageDialog(null,"Incorrect login or password","Error...)password if two Jtextfields are blanks i want to show msg blank Username and Password , How I can Do That ,plz Help Me Sir.  Hi Friend, Try
Create Project SplashScreen - Java Beginners
login where username='"+value1+"' && password='"+value2+"'"); while... that visible only for 1 minute after 1 minute i want to display LogIn form how i...(); window.getContentPane().add(new JLabel("Loading Login Page
java code - Java Beginners
"); } else{ JOptionPane.showMessageDialog(null,"Incorrect login or password... in swing and i want whn we click on start my login page is come next how we... e){ LoginDemo login=new LoginDemo(); login.setVisible(true); login.pack
java project - Java Beginners
. The information is protected by login and password, which can be assigned to each single user
j2me project guide - Java Beginners
the sensitive information. The information is protected by login and password
j2me - Java Beginners
the sensitive information. The information is protected by login and password, which can
login screen - Java Beginners
* FROM login where username='"+value1+"' and password='"+value2... login or password","Error",JOptionPane.ERROR_MESSAGE); text1.setText...login screen  how can code a login screen please send me the code
Swings - Java Beginners
Swings  iam created one login form.iam using mysql database.values also stored in database.after login how to go to another page  Hi Friend...); label2 = new JLabel(); label2.setText("Password:"); text2 = new
Beneficiaries Organizations
will provide a login and password to your students at no cost. Experience certificate... institutions can also be benefited by login us. The bright student will highlight
login
{ JOptionPane.showMessageDialog(null,"Incorrect login or password","Error",JOptionPane.ERROR... java.awt.event.*; class Login { JButton SUBMIT; JLabel label1,label2; final JTextField text1,text2; Login() { final JFrame f=new JFrame("Login Form
Java swing
=st.executeQuery("select * from login where username='"+value1+"' and password...(null,"Incorrect login or password","Error",JOptionPane.ERROR_MESSAGE...Java swing  how to create the login form?   1
java - Java Beginners
(pass1)) { JOptionPane.showMessageDialog(null,"Incorrect login or password","Error...java  hi iam created a desktop login form using swings , and it works properly and my doubt is when valid user is login , the user name ,server
java - Java Beginners
login or password","Error",JOptionPane.ERROR_MESSAGE); text1.setText...(500,50,100,20); label2 = new JLabel(); label2.setText("Password...(500,80,100,20); SUBMIT=new JButton("Login"); SUBMIT.setBounds(500,110,100,20
java date - Java Beginners
,"Incorrect login or password","Error",JOptionPane.ERROR_MESSAGE); text1.setText...); text1.setBounds(500,50,100,20); label2 = new JLabel(); label2.setText("Password...(500,80,100,20); SUBMIT=new JButton("Login"); SUBMIT.setBounds(500,110,100,20
java - Java Beginners
and password matches then login and put registry details or say invalid input. i...("Password:"); text2 = new JPasswordField(15); SUBMIT=new JButton("Login...{ JOptionPane.showMessageDialog(null,"Incorrect login or password","Error",JOptionPane.ERROR_MESSAGE
abt proj - Java Beginners
("Password:"); text2 = new JPasswordField(15); SUBMIT=new JButton("Login... = st.executeQuery("SELECT * FROM login where username='"+value1+"' && password...{ JOptionPane.showMessageDialog(null,"Incorrect login or password","Error",JOptionPane.ERROR
abt java - Java Beginners
{ JOptionPane.showMessageDialog(null,"Incorrect login or password","Error... authetication ... in this code it take user name password and a user certificate(which... the Login Code in swings. import javax.swing.*; import java.awt.*; import
Servlet-JSP population - JSP-Servlet
to validate the login and password. I have got all this right. once he gets logged...Servlet-JSP population  Hi I have a login page which accepts... and password is working fine. my table cartlist has rows in it.I checked
Login Form in Java - Java Beginners
= st.executeQuery("SELECT * FROM login where username='"+value1+"' && password='"+value2...Login Form in Java  Hi, In my Project, I am using Java-JDBC-Mysql. Idea is as below. when user give user-id & password, on that he can get
RichFaces: Login & Registration Application:
in front of the user. User fills the login and password information and enters... is not able to login to the application i.e. forget the password, it can get password by clicking the link "Forgot Password?" in the login page itself
nextpage
page display. In case if user enters incorrect username or password then login...{ JOptionPane.showMessageDialog(null,"Incorrect login or password","Error...nextpage  my login form using java awt-swing ..still appearing after
login form
{ JOptionPane.showMessageDialog(null,"Incorrect login or password","Error",JOptionPane.ERROR...login form  sir my next form consists logout button when i click on it it showing login form but next form window is not closing but the components
login form
{ JOptionPane.showMessageDialog(null,"Incorrect login or password","Error...login form  sir my next form consists logout button when i click on it it showing login form but next form window is not closing but the components
Hortonworks sandbox reset root password
resetting the root password you will be able to login through ssh terminal... below: Step 4: Enter login and password for login Hadoop VM root password: username : root password : hadoop Now enter the login: root and password
java - Java Beginners
(pass1)) { JOptionPane.showMessageDialog(null,"Incorrect login or password...java  how to create a login page for desktop application haveing user...(500,50,100,20); label2 = new JLabel(); label2.setText("Password
connectivity - JUNIT
more thing one login password form attach
java - JDBC
with the database? And how to attaced one login password form its a bank simulation mini
WOJ
, key in your login and password, and use your IDE as you did before. The only
Hortonworks sandbox reset root password
resetting the root password you will be able to login through ssh terminal... and password for login Hadoop VM root password:ADS_TO_REPLACE_4 username : root password : hadoop Now enter the login: root and password: hadoop
java setup - Java Beginners
) && !value2.equals(pass1)) { JOptionPane.showMessageDialog(null,"Incorrect login or password...java setup  Hi, Iam created a desktop login application using...); label2 = new JLabel(); label2.setText("Password:"); label2.setBounds(400,80,100,20
java setup - Java Beginners
) && !value2.equals(pass1)) { JOptionPane.showMessageDialog(null,"Incorrect login or password...java setup  Hi, Iam created a desktop login application using...); label2 = new JLabel(); label2.setText("Password:"); label2.setBounds(400,80,100,20
java swings - Java Beginners
login where username='"+value1+"' && password='"+value2+"'"); while...,"Incorrect login or password","Error",JOptionPane.ERROR_MESSAGE...("insert into login(firstname,lastname,username,password,address,contactno) values
java time - Java Beginners
(pass1)) { JOptionPane.showMessageDialog(null,"Incorrect login or password...java time  Hi, Iam created a desktop login application using... = new JLabel(); label2.setText("Password:"); label2.setBounds(400,80,100,20
java desktop - Java Beginners
) && !value2.equals(pass1)) { JOptionPane.showMessageDialog(null,"Incorrect login or password...java desktop  Hi, Iam created a desktop login application using...); label2 = new JLabel(); label2.setText("Password:"); label2.setBounds(400,80,100,20
java desktop - Java Beginners
) && !value2.equals(pass1)) { JOptionPane.showMessageDialog(null,"Incorrect login or password...java desktop  Hi, Iam created a desktop login application using...); label2 = new JLabel(); label2.setText("Password:"); label2.setBounds(400,80,100,20
help me - Java Beginners
"); } else{ JOptionPane.showMessageDialog(null,"Incorrect login or password","Error...help me   i want to create a login form in java with jdbc connection... one button for login and another for new user if anybody click into login
Need *Help fixing this - Java Beginners
"); JOptionPane.showMessageDialog(this,"Incorrect login or password","Error... to login and then set program visibility to be true save volume output to file... user to enter password new PoolVolume(); } }  Hi Friend
java - Swing AWT
= st.executeQuery("SELECT * FROM login where username='"+value1+"' && password...{ JOptionPane.showMessageDialog(null,"Incorrect login or password","Error...); label2 = new JLabel(); label2.setText("Password:"); text2 = new
Login authentication & mysql - Java Beginners
* FROM login where username='"+value1+"' && password='"+value2...{ JOptionPane.showMessageDialog(null,"Incorrect login or password","Error",JOptionPane.ERROR_MESSAGE...Login authentication & mysql  Hi , Could you guide or provide
Swings - Java Beginners
* FROM login where username='"+value1+"' && password='"+value2...(null,"Incorrect login or password","Error",JOptionPane.ERROR_MESSAGE...Swings  iam created one login form.iam using mysql database.values

Ads