2

I know how to let user input their password with input type="password" field in JSP. But I get their input password using servlet, it would show all characters. How do you hide these characters in regular HTML or JSP?

For instance, if I have

password: MKS09js5

how do I hide or make the password **? (This is not for search or input)

user3014926
  • 1,061
  • 7
  • 18
  • 26
  • Are you asking how to conceal the password across the network in case someone's packet-sniffing? Or are you saying your servlet receives the password in plaintext instead of `********`, and you would like to make it `*********`to make it difficult for the servlet? – MxLDevs Dec 10 '13 at 20:36
  • My servlet stores the password in plaintext. I have provided a JSP to display user info like username and password etc. In that JSP, the password for this user is currently displayed in plaintext. How can I display it with *****? – user3014926 Dec 10 '13 at 21:07
  • Couldn't you just manually render it as `******`? Like literally hardcode it. I mean, presumably they're supposed to know their password. Unless you want the exact number of `*`'s? – MxLDevs Dec 10 '13 at 21:08
  • The answer below didn't really answer my question since this is used to ask for user input. – user3014926 Dec 10 '13 at 21:08
  • 1
    What do you mean by "manually type ******"? This ****** is the password from my mysql database. I just want to print this to JSP with encryption. – user3014926 Dec 10 '13 at 21:11
  • That is what I am confused about. If all the user is going to see is ****** then why not just hardcode that value in your JSP so that it will be rendered as a sequence of *'s? – MxLDevs Dec 10 '13 at 21:13
  • Agree with MxyL. What will the purpose of this password field be. Do you want the user to be able to see their password or not? I don't get it. If you wanted the user to just know this is a password field then like @MxyL says hard code the ****. – Jetnor Dec 10 '13 at 22:31

2 Answers2

2

Hopefully this can help you.

<form:password path="password_field_name" value="my_password"/>
Ashish
  • 997
  • 6
  • 20
-2

You can use the input type "password" property as shown in w3schools website.

<form>
 Password: <input type="password" name="pwd">
 </form>

W3Schools tutorial

Jetnor
  • 521
  • 2
  • 11
  • 26