aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes How to hide passwords? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to hide passwords?" Watch "How to hide passwords?" New topic
Author

How to hide passwords?

Moguluri Ravi Kiran
Ranch Hand

Joined: Apr 16, 2010
Posts: 62

Hello to every one...

I written a servlet that sends a login form to browser, while submiting the form the password field value is being displayed in the URL, please tell me how to print the '*'s rather than printing the original value...



waiting for reply.

[moderator edited subject line: remove attempt to make title bold, changed all uppercase to mixed case]
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Use POST method while submitting the FORM.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Charles 'King
Ranch Hand

Joined: Jul 05, 2009
Posts: 56

Moguluri Ravi Kiran wrote:Hello to every one...

please tell me how to print the '*'s rather than printing the original value...


input type=password -> http://www.w3.org/MarkUp/html-spec/html-spec_8.html

By the way, this is a HTML question, not servlet
cho con
Greenhorn

Joined: Apr 02, 2010
Posts: 26
I think Sagar's problem is not about the input. He mentioned about sending request and it shows the password in the URL then it's not safe on the internet. I also have the same problem as yours, I guess that you are using GET method or hidden input with the action, right? I think you can try to use POST method, or look for some way to encode it before sending request (but I haven't tried it yet since I have only little time for my project). Hope that someone can give better solution.
cho con
Greenhorn

Joined: Apr 02, 2010
Posts: 26
I'm sorry for wrong name, Charles not Sagar
cho con
Greenhorn

Joined: Apr 02, 2010
Posts: 26
I forgot to say that when I use Form with POST method and hidden input control which contains the action, the password still be showed in the URL, you have any suggest for my case?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61238
    
  66

Please take the time to choose the correct forum for your posts. This forum is for questions on Servlets. For more information, please read this.

This post has been moved to a more appropriate forum.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61238
    
  66

Using a POST will prevent the password from being tacked onto the URL, but this does not add any level of security.

All requests that contain sensitive information should be performed under SSL.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

cho con wrote:I forgot to say that when I use Form with POST method and hidden input control which contains the action, the password still be showed in the URL, you have any suggest for my case?

I'd suggest your browser is fundamentally broken--POST requests will not show request parameters in the URL.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

cho con wrote:I forgot to say that when I use Form with POST method and hidden input control which contains the action, the password still be showed in the URL, you have any suggest for my case?

Problem might be in your code. Post the same code here. You might doing something wrong with the FORM.
Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
[hijack removed]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

@Samanthi: Don't hijack threads. You ever consider searching for these kinds of questions?!
cho con
Greenhorn

Joined: Apr 02, 2010
Posts: 26
Sagar Rohankar wrote:
cho con wrote:I forgot to say that when I use Form with POST method and hidden input control which contains the action, the password still be showed in the URL, you have any suggest for my case?

Problem might be in your code. Post the same code here. You might doing something wrong with the FORM.


This is my code part, when I use the method="post" sometimes it makes my code doesnot work, it still stay at the login page, just like after clicking submit button, it still get the same action leading to the login page, it also makes me confuse

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61238
    
  66

What's with the blank action?
cho con
Greenhorn

Joined: Apr 02, 2010
Posts: 26
Actually the action I did in the form means nothing. The response from server will depend on the "value" of the hidden input control name "action", then my servlet will manage the web depending on this value.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

cho con wrote:when I use the method="post" sometimes it makes my code doesnot work, it still stay at the login page, just like after clicking submit button, it still get the same action leading to the login page, it also makes me confuse

The empty action doesn't go anywhere. Its will stay on the same page.

cho con wrote:Actually the action I did in the form means nothing. The response from server will depend on the "value" of the hidden input control name "action", then my servlet will manage the web depending on this value.

Nope. This is NOT how request action is processed at server side. Server looks for the ACTION attribute of the FORM tag in order to decide which servlet/action to be called.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

(Well... a postback from will go to whatever page/servlet/JSP/etc. the client is already on, which may or may not do something with the hidden field to determine execution path. So if this page is being displayed via a servlet + forward, the post would go to that same servlet.)
 
wood burning stoves
 
subject: How to hide passwords?