Home Answers Viewqa JSF-Questions Database driven login form

 
 


Shiko Muturi
Database driven login form
1 Answer(s)      4 years and 7 months ago
Posted in : Java Server Faces Questions

View Answers

October 16, 2008 at 4:47 PM


Hi friend,


<%@ 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");
}


else{

response.sendRedirect("loginForm.jsp");

}


}

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

con.close();



} catch (Exception e) {

e.printStackTrace();

}

%>

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

Please visit for more information.

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

Thanks










Related Pages:
Database driven login form - Java Server Faces Questions
is code that; will create a database driven login form where users are authenticated only if their names and passwords are stored in a mysql database. thank you...Database driven login form  Dear sir,madam, Greetings!! well, am
Database driven webservices
WebService with database Mysql - A database driven webservice... Step 7: Click on the Ok  It creates the table login in the test database... Webservices. The user registration/account registration form will be presented
PHP Chat Systems A MySQL Driven
PHP Chat Systems A MySQL Driven Chat Script Tutorial This article will show you how to create a simple chat script using PHP and MySQL database...), whenever you login an unwanted message as "user: "could generate
Login Form
Login Form       Login form in struts: Whenever you goes to access data from database, as a register user you are always asked for the login
Login Form
of +,on clicking which a login form appears. Only the middle column is different for each of the page. How to write a code for login authentication so...Login Form  I have 8 jsp pages.Each of them has three columns:Left
Login Form
of +,on clicking which a login form appears. Only the middle column is different for each of the page. How to write a code for login authentication so...Login Form  I have 8 jsp pages.Each of them has three columns:Left
how to login form through spring dao module
how to login form through spring dao module  here i want to chek user details in database through form by using spring dao module.please give me some reference example to me
login form
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...() { setTitle("Login Form"); setLayout(null); label1 = new JLabel
login form
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...; LoginDemo() { setTitle("Login Form"); setLayout(null); label1 = new
Example of login form validation in struts2.2.1framework.
Example of login form validation in struts2.2.1 framework. In this example, we will introduce you to about the login form validation in struts2.2.1 framework. Our login form validation example does not validate the user against
PHP MySQL Login Form
will study how to create a login form, connect with the database server and login...Login Form using PHP and MySQL: In any website generally it is mandatory to have a login form to keep your data secure. In this regard we need to have
login
login  how to login admin and user with the same fields(name & password) in single login page while the table for admin and user is seprate in database(mysql) please provide me solution
login
login  i want to now how i can write code for form login incolude user and password in Jcreator 4.50   Hello Friend, Visit Here Thanks
login
login  how to create login page in jsp   Here is a jsp code that creates the login page and check whether the user is valid or not. 1)login.jsp: <html> <form name="form" method="post" action="check.jsp">
login
java.awt.event.*; class Login { JButton SUBMIT; JLabel label1,label2; final JTextField text1,text2; Login() { final JFrame f=new JFrame("Login Form...(); ResultSet rs=st.executeQuery("select * from login where username='"+value1
Login form and registration
Login form and registration  I need a complete code for ligin and new user registration form and validation
administrator login form
administrator login form   Hi iam using struts frame work backend as oracle .i want code for administrator login form thanks in advance
add cookies to login form in jsp by using struts2.0 framework
add cookies to login form in jsp by using struts2.0 framework  hi sir... struts2.0 and hibernate3.0 and mysql database for login .jsp now i want to add cookies to above form please help me
Struts 2 Login Form Example
Struts 2 Login Form Example tutorial - Learn how to develop Login form... you can create Login form in Struts 2 and validate the login action.... Let's start developing the Struts 2 Login Form Example Step 1
Spring login form application
Spring login form application  Hi Please give me the Spring login form application so that i can understand its flow ?   Hi please find the link of the tutorial Spring Applications
login form - JSP-Servlet
login form  Q no.1:- Creat a login form in servlets?  Hi...*; import javax.servlet.http.*; public class Login extends HttpServlet...(); pw.println(""); pw.println("Login"); pw.println(""); pw.println
A Message-Driven Bean Example
A Message-Driven Bean Example   ... messages asynchronously,  a Message-driven bean is used. Message driven..., email or IM messages). In message driven beans, the messaging service
login form validation - JSP-Servlet
login form validation  hi, how to validate the login form that contains user name and password using post method . the validation should not allow user to login in the address bar thanks regards, anand
Login form in jscript
Login form in jscript  For example the html script is <...; charset=utf-8" /> <title>:: validation form::</title> <script...;td align="center" valign="top"> <form name="form1" onsubmit
Ejb message driven bean
.style1 { color: #FFFFFF; } Ejb message driven... you the process which are involved in making a message driven bean using EJB. Mesaage driven bean in EJB have the following features:- 1) is a JMS listener
standart login form for messenger in java
standart login form for messenger in java  hi i need login from for chating messenger in java. but its structure would like this Home Register Login User ID Password   Hi Friend
standart login form for messenger in java
standart login form for messenger in java  hi i need login from for chating messenger in java. but its structure would like this Home Register Login User ID Password   Hi Friend
Developing Login Action Class
for login action class and database code for validating the user against database... the user id and password from the login form and checks the login id and their corresponding password in the database. If matching is found the login action
database
database  i am created one table in mysql database with one... or not. If it is already exist in database, then show a message 'Already exists...;/head> <body> <form name="form"> Email Id: <input type="text
Spring alternative to Form Based Login
Spring alternative to Form Based Login  print("code sample");how can we make a server to listen to login event i.e. Authenticate a user not using jsp. Using a login form we can use the jspringsecurity_check. How can we do
login page - Java Beginners
login page  I have one login page in jsp that is login.jsp. Now i have validate user from database by another page validate.jsp. but if the user...://www.roseindia.net/jsp/user-registration-form-using-jsp.shtml
How to view database for user when they login in netbeans and mysql?
How to view database for user when they login in netbeans and mysql?  I create a web page where when user login they have to fill in a form, after... database with jdbc connection. thanks for your help
Login form
Login Form with jsp      ... of login form will really help to understand jsp page. In this  example we... are going to insert the data in the login form which will be displayed onto
SWT login form - Swing AWT
SWT login form  Hi, I want code to create a login form in SWT. My...(2, false)); shell.setText("Login form"); label1=new Label(shell...|SWT.CANCEL); messageBox.setText("Login Form"); messageBox.setMessage
Struts 2.1.8 Login Form
Struts 2.1.8 Login Form      ... to validate the login form using Struts 2 validator framework. About the example: This example will display the login form to the user. If user enters Login Name
Login Form in Java - Java Beginners
Login Form in Java  Hi, In my Project, I am using Java-JDBC-Mysql...) How to create frontage form in java to validate it. regards, Prashant...*; import java.awt.*; import java.awt.event.*; import java.sql.*; class Form
how to retreive data from database of a particular user after login
how to retreive data from database of a particular user after login  ... the user information.. now their is a login and registration page for newuser. after the user has filled the form he should go to the welcome page where he
Login With Drop Down
Login With Drop Down   Hi all, I am doing a project using JSP. My Issue is..... I have two departments name Customs and Accounts in the database... box and then login to the page. I have a drop down list box with Customs
Spring 3 MVC Login Form Example
Spring 3 MVC Login Form Example  In this tutorials  we are showing.... In the example we are creating a LoginForm. In the login form there are two... respectively. If any user enter correct username and password then login success page
JSP Login Page Question
JSP Login Page Question  hey..i have a login page where different users first registered and then after they can login. my question is how a user can see only his data after login where different users data are stored
PHP Chat Systems A MySQL Driven Chat Script Tutorial
PHP Chat Systems A MySQL Driven Chat Script Tutorial   ... script using PHP and MySQL database. The application will allow visitors... for actual users) , whenever you login an unwanted message as "user: "
Spring Security customized login from database
Spring Security customized login from database In this section, you will learn... in database table. EXAMPLE In the below example, we have created a customized login page but the login is checked from the database table. We have added spring
login form using java bean in eclipse
login form using java bean in eclipse  I have made a college community website but i need to implement beans to my login and contact us page. how can i do
JSP data after login where different users data are stored in database
JSP data after login where different users data are stored in database  hey..i have a login page where different users first registered and then after they can login. my question is how a user can see only his data after login
getting error in your login form code
getting error in your login form code  i tried your code for login form but i am getting an error.the error is undefined index userid...   hi friend, your form's input must have following : <input type
Login authentication
Login authentication  i want d code for login authentication from mysql database on the same pc using swings
Login authentication
Login authentication  i want d code for login authentication from mysql database on the same pc using swings
Login form using Jsp in hibernate - Hibernate
Login form using Jsp in hibernate   Hai Friend, As I new To hibernate, I'm facing problem in My project(JSP with hibernate).. My login form... and entering into Menu Form.. plz can any one help for my problem... Thanks
Login Application
the selected user Id and password for further login. Fig: Form Validation... Login Application       This tutorial provides some simple steps for creating a website login
How to put the image in footer in login form ?
How to put the image in footer in login form ?  Hi, how to put the image in footer in login form ?   Here is an example that shows image on footer along with Login Form in Java Swing. import javax.swing.*; import

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.