Results 1 to 20 of 21
Thread: Developing a logon screen
- 05-14-2009, 01:32 AM #1
Member
- Join Date
- Feb 2009
- Posts
- 27
- Rep Power
- 0
Developing a logon screen
Hey, i want to create a java login applet, which can be embedded in to a web page and send information such as user name and password to a servelet to be validated by a database.
Are there any tutorials around showing this? I have had a look on the net and i cant find anything. I can create a simple login which has the user name and password embedded in to the code but im totally lost when creating a login which communicates wiht a servlet then on to a database.
- 05-14-2009, 03:30 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
JSP is much better than Applet for your requirement. What's the point of use Applet in your project?
JSP Tutorial - Java Server Pages Tutorials
- 05-14-2009, 11:46 AM #3
Member
- Join Date
- Feb 2009
- Posts
- 27
- Rep Power
- 0
Been told we must use a applet and servlet
- 05-14-2009, 06:06 PM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
I think it's better to read more about JSP/Servlet by you before doing this.
JSP are actually Servlet. In backend JSP are compiled into Servlet. Best way is, you can keep member details in a database and validate in a Servlet.
- 05-14-2009, 06:11 PM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 05-15-2009, 02:01 AM #6
Member
- Join Date
- Feb 2009
- Posts
- 27
- Rep Power
- 0
Thx, i have the applet passing a string (username and password) to the servlet, and i have a seperate servlet which can read from a database, (for simplicity im using access database) however i cant think how to query a username or password against a database . :(
- 05-15-2009, 05:31 AM #7
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Ok, what you have tried(the query) to deal with the user name and the password?
- 05-15-2009, 10:24 AM #8
Member
- Join Date
- Feb 2009
- Posts
- 27
- Rep Power
- 0
well what i have noticed is when you send the data, user name and password, it comes through as one string, so im trying to split that up first
- 05-15-2009, 12:17 PM #9
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Here is a simple code I've with me on one of my application, just a part of it. I don't know how far it's clear to you. Have a look at it and try to understand what's going on there.Java Code:<body> <% String url = "jdbc:odbc:userDSN"; String username=""; String password=""; Connection conn=null; String classPath = "sun.jdbc.odbc.JdbcOdbcDriver"; String usernm = username; // Validating user name String passwrd = password; // Validating password try{ Class.forName(classPath); conn = DriverManager.getConnection(url,username,password); }catch(Exception exc){ out.println(exc.toString()); } %> <% Statement stm=null; ResultSet rst=null; stm= conn.createStatement(); String query= "SELECT userID, password FROM user WHERE userID =" +usernm; rst = stm.executeQuery(query); %> <%= rst.getString("userID") %> <%= rst.getString("password") %> <% if (usernm.equals(userID) && passwrd.equals(password)) { %> <jsp:forward page = "index.jsp"></jsp:forward> <% } else { %> <jsp:forward page = "login_handle.jsp"></jsp:forward> <% } rst.close(); stm.close(); conn.close(); %> </body>
- 05-15-2009, 12:17 PM #10
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 05-16-2009, 12:28 AM #11
Member
- Join Date
- Feb 2009
- Posts
- 27
- Rep Power
- 0
Cool, ive managed to split the string up in to user name and password, now all i need is to connect to an access database and compare with the results which are in that
- 05-16-2009, 12:51 AM #12
It's a good idea to only store and transmit secure hashes of passwords, rather than the passwords themselves.
Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
How To Ask Questions The Smart Way
- 05-16-2009, 01:26 AM #13
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
I agreed with you OD. I just trying to point-out in my code just the model of login page. Actually at the very first step, he/she don't have an idea what the technology need to use and lot more to understand.
That's why I point the hard corded credentials there.
- 05-16-2009, 11:15 AM #14
Member
- Join Date
- Feb 2009
- Posts
- 27
- Rep Power
- 0
dont worry about password security i just need once the variables have been sent to connect to a database and compare with what is in the database. If they pass that test, then i can gain access and go in
- 05-16-2009, 07:22 PM #15
But if they're not hashed, so can everyone else.
Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
How To Ask Questions The Smart Way
- 05-16-2009, 08:59 PM #16
Member
- Join Date
- Feb 2009
- Posts
- 27
- Rep Power
- 0
what do you mean by hashed?
- 05-16-2009, 09:11 PM #17
Cryptographic hash function as used in digest authentication and others.
Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
How To Ask Questions The Smart Way
- 05-16-2009, 09:20 PM #18
Member
- Join Date
- Feb 2009
- Posts
- 27
- Rep Power
- 0
oh rite, ok, i really want to keep this simple, i dont really need anything like that in there
- 05-17-2009, 03:28 AM #19
Just as long as you know that a system where plaintext passwords are transmitted and stored is in no way secure.
Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
How To Ask Questions The Smart Way
- 05-17-2009, 10:02 AM #20
Member
- Join Date
- Feb 2009
- Posts
- 27
- Rep Power
- 0
Similar Threads
-
Blank Screen while navigating from one screen to another
By mohana.krishna in forum Java ServletReplies: 0Last Post: 03-03-2009, 05:03 PM -
developing a password vault
By ramesh.8189 in forum Threads and SynchronizationReplies: 6Last Post: 02-03-2009, 06:32 AM -
developing a GUI for solaris 10
By DuceDuceExplorer in forum NetBeansReplies: 5Last Post: 08-05-2008, 06:00 AM -
help in email developing
By reached in forum New To JavaReplies: 0Last Post: 12-09-2007, 07:55 PM -
Developing for Mac
By jmds in forum NetBeansReplies: 0Last Post: 11-25-2007, 07:55 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks