<%@ page import ="java.sql.*" %>
<%@ page import ="javax.sql.*" %>
<html>
<head>
<style>
body{
background-color:#F5FFFF;
opacity:0.9;
filter:alpha(opacity=80);
}
h1{
color:#010066;
font-size:80px;
text-align:center;
}
h1.underline{
text-align:center;
margin-top:-20px;
margin-bottom:40px;
}
h2{
color:#010066;
font-size:22px;
text-align:center;
}
h3{
color:#010066;
font-size:14px;
text-align:center;
}
#cen
{
color:#010066;
text-align:center;
}
</style>
<script>
</head>
<body>
</p>
<h1 >ERICSSON</h1>
<h1 class="underline"><img src="line.png" align="top" height="10" width="420"></h1>
<br>
<br>
<h3>Please Enter your Login Details!</h3>
<br>
<br>
<p id='cen'>USERNAME : <input type="text" name="usr"/>
<br>
<br>
PASSWORD : <input type="password" name="pwd" />
<br>
<br>
<input type="button" value="LOGIN" id="LOGIN">
</p>
<%
String Username = request.getParameter("usr");
String Password = request.getParameter("pwd");
Class.forName("com.mysql.jdbc.Driver");
java.sql.Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/proj","root","root");
Statement st = con.createStatement();
ResultSet rs1 = st.executeQuery("select password from login where username = '"+Username+"'");
if (rs1.next())
{
if(rs1.getString(1).equals(Password))
{
}
}
else
{
}
%>enter code here
</body>
</html>
当用户输入正确的登录详细信息时,我想重定向到 home.jsp。当用户输入错误的登录详细信息时,它应该留在同一页面上并清除文本框。我尝试了很多东西,但它不起作用。请帮忙!