【发布时间】:2017-01-27 03:38:29
【问题描述】:
我是在 3 天前才被介绍到 JSP 的,所以我对它还不是很熟悉。
所以我这里有这段代码:
<body>
<form method="post">
<center>
<table border="1" cellpadding="5" cellspacing="2">
<thead>
<tr>
<th colspan="2">Login Here</th>
</tr>
</thead>
<tbody>
<tr>
<td>Username</td>
<td><input type="text" name="username" required/></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password" required/></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Login" />
<input type="reset" value="Reset" />
</td>
</tr>
</tbody>
</table>
</center>
</form>
注意:此代码是从互联网借来的。将其连接到 mySQL 后,我将对其进行更改。归功于 Lahaul Seth。
所以我想知道如何调用下面的代码。
String username = request.getParameter("username");
String password = request.getParameter("password");
if(Login.LoginA(username, password).equals("Admin")){
out.println("Admin");
}else if(Login.LoginA(username, password).equals("Employee")){
out.println("Employee");
}else{
out.println("Unidentified User");
}
我想我必须对 html 部分中的登录按钮做一些事情,但我不知道怎么做。希望你们能帮助我。 谢谢!
【问题讨论】:
-
花点时间阅读Tutorial。
-
我试过了,但还是不能很好的理解。我认为,如果我对它的实际工作原理有所了解,我将能够更好地理解本教程。所以我问了。
标签: java mysql jsp web-applications