This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes Dynamic control of textbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Dynamic control of textbox" Watch "Dynamic control of textbox" New topic
Author

Dynamic control of textbox

Avik Mazunder
Ranch Hand

Joined: Jun 27, 2012
Posts: 39

I want to change the border colour of textbox if someone enter wrong password....Is there any method for changing border colour dynamically??
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15961
    
  19

Yes. Add a "styleClass" attribute to the control and make its value be an EL expression based on whether the password is right, empty, or wrong.

Although actually telling someone that their password specifically is wrong is considered bad security practice if the password is being combined with other security tokens such as userIDs. In such cases, the recommended response is simply to indicate that one or more of the tokens is invalid. Otherwise, hackers know which tokens they have that work and don't need to do as much work to find the values of the remaining tokens.


Customer surveys are for companies who didn't pay proper attention to begin with.
Avik Mazunder
Ranch Hand

Joined: Jun 27, 2012
Posts: 39

Tim Holloway wrote:Yes. Add a "styleClass" attribute to the control and make its value be an EL expression based on whether the password is right, empty, or wrong.


Can you give me an example please??
Thanks
Cesar Alforde
Greenhorn

Joined: Feb 21, 2009
Posts: 3

when you keep a secret, the less information you give is the better, if you say "you password is wrong" at the same time the hacker says "ahh but the username is correct!" , then he just have to find the right password not both, or he can use this info that you leaked to find more usernames. For this reason is better just to say "Username or password incorrect"

 
Don't get me started about those stupid light bulbs.
 
subject: Dynamic control of textbox
 
Similar Threads
jTextField default border color
WA #1.....word association
How can I keep focus on the component pressed until I pressed other component????
Changing the text color
How to read contents of a different Textbox's on a Tab in a TabPanel