0
成功輸入用戶名和密碼後,我有一個用戶名和密碼登錄頁面,它轉發到登錄控制器。 我的問題是,當轉發到下一頁時,在URL中顯示密碼輸入。我需要加密並通過控制器發送,並且必須解密通過控制器。加密密碼
這是我的代碼。
的jsp:
<form action="Login" onsubmit="return validate1()">
<h3>
<font color="red">username</font>
</h3>
<input type="text" name="username" id="username" /><br>
<h3>
<font color="red">password</font>
</h3>
<input type="password" name="password" id="password" /><br> <input type="submit" value="submit" />
</form>
的javascript:
<script>
function validate1() {
return validate();
}
function validate() {
var isValid = true;
var name = document.getElementById("username").value;
var password = document.getElementById("password").value;
if (name.length == 0) {
isValid = false;
alert("Username empty");
} else if (password.length == 0) {
isValid = false;
alert("Password empty");
}
return isValid;
}
</script>
網址: http://localhost:8080/PSMS/Login?username=jay&password=jay
這裏的密碼是可見的,我需要對密碼進行加密,並轉發給控制器,其中再次我有解密該密碼。
一個選項是你可以使它成爲post方法,所以它不會顯示在URL中。 –
你也應該使用https。 – anolsi
在'form'中使用'method = Post',它不會在URL中顯示 –