This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi all, I wanted to know given a html page that contains "username" and "password" options.I want to send the values that are being typed in the username and password options to a servlet. Kindly let me know how this is done in detail.I have written a little piece of code to do this.The code is below
In the form tag I am finding it difficult as to how it can be done. Kindly let me know. Hoping to hear from you. Thanking you AS
This seems fine to me. Now in the AuthenticateServlet2 servlet's doGet method, you can retrieve the values by: String username = request.getParameter("username"); String pw = request.getParameter("password"); What problem are you having, specifically?
No more rhymes! I mean it!<br /> <br />Does anybody want a peanut?
A couple of things to consider, since you're dealing with "sensitive" information (user names and passwords): 1) Use "POST" instead of "GET" - otherwise the values get sent as clear text on the URL, regardless of whether you're using SSL or not. 2) Use SSL so that the values aren't sent as clear text in the POST headers.
Also since the the "POST" method is better way to go because the data will not be seen as a part of the URL. You need to put your code in the doPost method instead of the doGet method. Also it is very common to forward doPost and doGet paramaters to a single method, something similar to below: