LOGIN PROBLEM 1 Answer(s) 4 years and 5 months ago
Posted in : JDBC
View Answers
February 11, 2009 at 11:42 PM
Harikrishna,<br/> The data you provided is partly incomplete. I am giving the solution considering you have Oracle in your system. If you have any other DB, check the Connection and Drivermanager parts.<br/><br/>
The answer contains 2 parts<br/> 1. Registering the user<br/> - Create a table in the Database to store user details<br/> - Put some Signup screen and ask user to enter details along with desired user name and password<br/> - On submit, send the data to a Jsp or servlet (preferable).<br/> - Do a primary validation, like empty values and special charecters etc, on the data entered.<br/> - Using JDBC create a connection and store the values in the database<br/><br/>
2. Validating the login<br/> - After submitting the User ID and Password in the login page, forward the control to a jsp or servlet(preferable).<br/> - Do a primary validation, like empty values and special charecters etc, on the data entered.<br/> - Using JDBC create a connection<br/> - Create a Statement/ PreparedStatement object and send the connection object as parameter.<br/> - Create a Resultset object<br/> - Execute the query to retrive the user details for given User ID, and store the values in the Resultset Object<br/> - Validate the resultset and content and check for the data in the Password column with the password given by the user<br/><br/>
================================================<br/> Here I am putting some sample code.<br/> Send user id and password as commanline arguments.<br/> Create a table "usermaster" in oracle with uid, pwd, username as columns.<br/> I just wrote this code on flow. I even't compile this code. This is just to give an idea to you. Hapy Programming ;-) ================================================<br/> import java.sql.*
public class JDBCSample {
public static void main( String args[]) {
static String userid=?scott?, password = ?tiger?; String connectionURL = "jdbc:odbc:test"; // Change the connection string according to your db, ip, username and password
try { // Load the Driver class. Class.forName(?sun.jdbc.odbc.JdbcOdbcDriver?); //Or any other driver
// If you are using any other database then load the right driver here. For example, for PostgreSQL, Class.forName("org.postgresql.Driver");
//Create the connection using the static getConnection method dbConnection=DriverManager.getConnection(connectionURL,userid,password)
//Create a Statement class to execute the SQL statement statement = dbConnection.createStatement();
//Execute the SQL statement and get the results in a Resultset rs = statement.executeQuery("select username from usermaster where uid='"+args[0]+"' and password='"+args[1]+"'"); //To insert data use the following code // rs = statement.executeUpdate("insert into usermaster set uid='"+args[0]+"' and password='"+args[1]+"', username='" +args[2]+"'");
// Check the ResultSet for values if(rs.next()) { // fetch the row data using the getString method System.out.println("Welcome " + rs.getString("username")); } else { System.out.println("Invalid UserID/Password "); } } catch (SQLException sqle) { sqle.printStackTrace(); } catch (Exception ex) { e.printStackTrace(); } finally { // Close the connection try{ dbConnection.close(); rs.close(); } exception(Exception ex){ ex.printStackTrace(); } } } }
Related Pages:
struts- login problem - Struts
struts- login problem Hi all, I am a java developer, I am facing problems with the login application. The application's login page contains fields like username, password and a login button. With this functionality only
LOGIN PROBLEM - JDBC LOGINPROBLEM sir iam harikrishna studying B.Tech Fourth year
sir i'm designing one website
in that one i have to give facility as login id and passowrd
then my problem is how can we write the code for validating the userid
login problem in java bean - Java Beginners loginproblem in java bean login.jsp no longer redirects..., it is displaying login failed and login success correctly. can u help me with the code immediately Hi friend,
Please give in details of problem
login and logout login and logout >
>
> > hi,
> >... home.jsp code i
> created a login form and after submitting... page.
> >
> > The problem is, when i am
problem in swing program for opening two windows with same login credentials problem in swing program for opening two windows with same login... developed one application using swings that has username,password when i login... windows with same user ..........but i want when i login into the system with same
login authentication - Java Beginners login authentication i 've problem in authenticating users thru jsp...()){
System.out.println("login success...("Login failed");
//username
login
login login page display an error showing failure to login even when the correct information is entered
Regarding Login application program
Regarding Login application program Hi this is shiva. iam writing a small login form using struts1.3.10 version. once iam submit the login button...
-----------------------
is there any problem Please send to my mail id(shivatwoshiva@gmail.com
create a login project - Development process
create a login project How to make an application(project)OF LOGIN APPLICATION USING MYSQL DATA BASE TO REGISTER AND LOGIN IN JSF FRAMEORK. Hi friend,
For solving the problem visit to :
http://roseindia.net/jsf
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
Controling login - JDBC
and jsp
plz............send some guidelines to solve that problem
can u plz...;
}
For login application on JSP visit to :
http://www.roseindia.net/jsp/loginbean.shtml
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
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
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...;tr><td></td><td><input type="submit" value="Login">
login
login i am doing the project by using netbeens.. it is easy to use the java swing for design i can drag and drop the buttons and labels etc.. now i want the code for login.. i created design it contains the field of user name
login
login i am doing the project by using netbeens.. it is easy to use the java swing for design i can drag and drop the buttons and labels etc.. now i want the code for login.. i created design it contains the field of user name
login
login i am doing the project by using netbeens.. it is easy to use the java swing for design i can drag and drop the buttons and labels etc.. now i want the code for login.. i created design it contains the field of user name
login
login i am doing the project by using netbeens.. it is easy to use the java swing for design i can drag and drop the buttons and labels etc.. now i want the code for login.. i created design it contains the field of user name
Problem with cookies Problem with cookies Hello All,
i need jsp code for RememberMe module of login.
i am facing problem with cookies. so please if any one could guide me please help and provide mme the exact code.
Please visit
struts problem
)
org.apache.jsp.loginjsp.jspxmethhtmlform0(login_jsp.java:128)
org.apache.jsp.loginjsp.jspxmethhtmlhtml0(login_jsp.java:102)
org.apache.jsp.loginjsp.jspService(login_jsp.java:71
HttpSession problem :(
HttpSession problem :( i want to ask that do i need to define httpsession in every servlet or jsp in my web application? if yes, then on which servlet? the very first one like my welcome page which comes after login page
SWT login form - Swing AWT
SWT login form Hi,
I want code to create a login form in SWT.
My requirement is that when the user clicks "enter" button from keyboard "login...,
Code to solve the problem :
import org.eclipse.swt.SWT;
import
jdbc problem
jdbc problem hi my name is mohit...i am making a project in java... a lot...
1)login page(this is made in swings)
public class loginpage extends...");
jButton1.setText("login");
jButton1.addActionListener(new
logout problem
me out of this...
the problem is -- when i logout , the user goes... he has come from ..
please get me out of this problem thanks.
Use...="login.jsp"><b>Login </b></a>
<%}
else{%>
<a href
Servlet problem problem from last three month and now i hope rose india developers... connectivity code it works but problem is with servlet page.
My servlet code... = "SELECT * FROM login ";
rs = st.executeQuery(sql);
do
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 is working but the problem is ,when i enter correct user name and password
problem in programming - JSP-Servlet problem in programming Hi!
I am new with jsp. I am facing a problem in programming to calculate the time interval between login time and logout time of user
verfication of user login and then redirecting it to user defined page
verfication of user login and then redirecting it to user defined page hi,
i have a login page that..calls the servlet..and i have used redirect... page..
after i press the submit button..in the login page, i am getting
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 and password.the code is $fuser=$POST["userid"];. how to solve this problem please help me
jsp/servlet login program - JSP-Servlet
jsp/servlet login program hello sir,
well i have a problem... a login program where a new user will be registered
and his/her details stored... the example it is working properly. If it arises problem on your system just try
Role based login ..Need the concepts.. - JavaMail
Role based login ..Need the concepts.. Role based login how can i do...
Hi friend,
This code help to solve your problem :
Some...".
Login Name
Admin
Employee
Login Name
JSP Login Logout Example
the error message after if any problem getting in login to
the user...JSP Login Logout Example
In this section we will discuss how to create a simple login and logout
example.
This section will describe you all the steps
Struts Hibernate Spring - Login and User Registration - Hibernate
Struts Hibernate Spring - Login and User Registration Hi All,
I fallowed instructions that was given in Struts Hibernate Spring, Login and user.../hibernate-spring/index. shtml) but the problem is that Registration doesn't register
tomcat server problem
placing a problem with tomcat5.5 server.
when i am trying to execute my project I... login page of the project and when i entered the username and password the blank page is appeared.
please resolve my problem as soon as possible.
thanking you
logout problem.. - JSP-Servlet
logout problem.. hi...
first of all thanks for ur... but their is some problem with the the logout,i m not able to logout when...(M.V.C),when a user login's and after doing some work he click logout he
PROBLEM IN FORM VALIDTION PROBLEM IN FORM VALIDTION i applied validation IN THIS JSP PAGE.if i... the PROBLEM is that after i press OK on validation prompt,the page goes... enter Login Name." );
document.loginform.userName.focus();
return false
code problem - Java Beginners
code problem i've to send a login packet( username & password) to the server with its length in ASCII format and aslo receive data in ASCII format, what code should be compatible, as i heared with UDP programing
code problem - Java Beginners
());
}
}
}
Dear sir,
my problem is that suppose i enter line number: 3
if line number 3 contains "john" then it should display correct login else incorrect login.
how to sort it out,
help me plz.
Hi friend,
We check
code problem - Struts
();
System.out.println(conn);
//Code to generate new sheet i.e login time IS NULL...();
//Code to open existing sheet i.e if login time != NULL... problem its urgent i dont know wht is exact primary key and foriegn key indicate
validation problem in struts - Struts
validation problem in struts hi friends...
m working on one project using struts framework. so i made a user login form for user authentication...);
}
}
plz help me to correct d user authentication problem
Solve this problem plzzz
Solve this problem plzzz Prashant.jsp (this is my JSP file)
<HTML>
<HEAD>
<TITLE>Login using jsp
<BODY>... kindly help me and check all those files and solve my problem as soon as possible
hibernate update problem
hibernate update problem HI,
I integrated the struts and hibernate and wrote the following query in the databean to update the user table login time
SessionFactory sessionFactory = (SessionFactory)context.getAttribute
Code Problem - Struts
Code Problem Sir, am using struts for my application.i want to uses session variable value in action class to send that values as parameter to function.ex.when i login into page,i will welcome with corresponding user homepage
Problem in my code - Development process Problem in my code Plz go thru this code. I want to check login... is not saved with that name.
Any ways, follow these steps to login:
1) Create...) create loginSuccess.jsp and print the mesage You have successfully login
logout problem - Java Beginners
have logout. Please try again Login Hi<html><head><title>login page in jsp</title></head><body><table border...="POST" action="loginAction.jsp"> <h2>Login Page
database problem - JDBC
database problem I installed Oracle 8.05 on Redhat 6.1 linux. If i fire up SQl plus seesion from the localhost, i can login succsfully as any user, If i go to a win98 or NT machine, I will get the following error after trying
Java program problem
Java program problem Hi,
I took the chance to login here in your educational page due to my questions in mind about my java programming assignment. Please help me. I provided below the program assignment. Thanks in advance
struts 2 problem with netbeans - Struts
struts 2 problem with netbeans i made 1 application in struts2... / and action name login.
The requested resource (There is no Action mapped for namespace / and action name login.) is not available.
here give two code what