This week's book giveaway is in the Java in General forum.
We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line!
See this thread for details.
Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Login password

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,

Can anyone provide me with simple code for login and password.I need to use it in client/server connection.
thanks

Olliver
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The answer to your question can be found here:

How to ask a good question
 
Olliver Lim Kam Sian
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well at least help me get started, which class to use for example. The thing is i need a seperate .java file which is the login and password code so i can call for before the client connects to the network, all i'm asking is that if you have something in hand, if you can post it so I can work on it!Im not asking you guys to do the whole thing for me. Just help me get started


thanks Olliver
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's a simple example of doing it with Spring and JSF

Login.jsp
---------
.....

value="#{loginBean.username}"
....
value="#{loginBean.password}"
.....
action="#{loginBean.loginAction}"

loginBean
--------
..
private String username;
private String password;
public String getUsername(){return username;}
public void setUsername(String username){ this.username=username;}
public String getPassword(){return password;}
public void setPassword(String password){this.password = password;
...


public String loginAction()
{
String usernameTxt = this.getUsername();
String passwordTxt = this.getPassword();
try
{
//get the password from DB
...
//then compare with the one you get from the JSP page
//if not match, return to login.jsp
if(...)
{
return "LOGIN_PAGE";
}
}
catch(Exception e)
{
e.printStackTrace();
return "ERROR_PAGE";
}
return "LANDING_PAGE";
}
 
chloe wong
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
for better secure, you can do some javascript validation checking.

Normally password are stored in DB as encrypted, not plain text.
So, in order to cehck the mactching, you can encrypt (MD5) your password frm login, then oni compare wtih the passwrod retrieve from DB.

Good Luck
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by chloe wong:
for better secure, you can do some javascript validation checking.


JavaScript is publically available to the client and may be turned off. It is not a good candiate technology to choose to implement any security or validation functionality (beyond suggestions to the user that may preclude the need for a server round trip).
[ October 26, 2007: Message edited by: Paul Sturrock ]
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic