📄 newlogin.jsp
字号:
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>New Hospital</title>
<style type="text/css">
<!--
.style11 {font-size: 18px}
.style16 {font-size: 16}
.style19 {font-size: 14px; color: #663300;}
.style1 {color: #663300}
.style14 { color: #660033;
font-weight: bold;
font-size: 18px;
}
.style5 {color: #660000; font-size: 14px; font-weight: bold; }
.style20 {
color: #009900;
font-weight: bold;
font-size: 18px;
}
.style21 {
color: #009900;
font-size: 18px;
}
.style22 {
font-size: 18px;
color: #6600CC;
font-weight: bold;
}
-->
</style>
</head>
<script language="javascript">
function val(form1)
{
if(form1.username.value=="")
{
alert("User Name is Empty");
return false;
}
if(form1.password.value=="")
{
alert("Password is Empty");
return false;
}
}
</script>
<body>
<form name="form1" method="post" action="" onSubmit="return val(form1)">
<table width="838" border="1" align="center" bordercolor="#00CC00">
<tr>
<td width="828" height="311" align="center" valign="middle" bordercolor="#00CC00" background="Ayur2.JPG"><div align="center"></div></td>
</tr>
<tr>
<td height="486" align="center" valign="middle" bordercolor="#00CC00"><div align="center">
<table width="818" border="0">
<tr>
<td width="441" height="474"><table width="100%" border="0">
<tr>
<td height="181"><p align="center" class="style20"><u><a href="newhome1.jsp">KLE's B.M.Kankanwadi Ayurved Hospital</a> </u></p>
<p>
<input name="imageField" type="image" src="college--hospiatl112.JPG" width="496" height="165" border="0">
</p>
<p align="center"><strong><span class="style21"><u>KLE's B.M.Kankanwadi Ayurved College </u></span></strong></p></td>
</tr>
<tr>
<td height="221" background="college.jpg"> </td>
</tr>
</table></td>
<td width="367"><div align="right">
<p align="center" class="style22"><u>KLE's B.M.Kankanwadi Ayurved Hospital</u> </p>
<p align="center" class="style11"><span class="style19">Are You a Doctor Or Worker of the Hospital?</span><span class="style16"> </span></p>
<table width="86%" align="center">
<tr bgcolor="#669900">
<td width="39%" height="29"><div align="center"><span class="style14">Login</span></div></td>
<td> </td>
<td width="60%"><div align="left"></div></td>
</tr>
<tr bgcolor="#CCCC00">
<td height="29"><div align="center" class="style5">User Name</div></td>
<td> </td>
<td>
<div align="left">
<input name="username" type="text" id="username">
</div></td>
</tr>
<tr bgcolor="#CCCC00">
<td height="31"><div align="center" class="style5">Password</div></td>
<td> </td>
<td><div align="left">
<input name="password" type="password" id="password">
</div></td>
</tr>
<tr bgcolor="#669900">
<td height="26"> </td>
<td> </td>
<td><div align="left">
<input name="Submit" type="submit" class="style1" id="Submit" value="Login">
<%
if(request.getMethod().equals("POST"))
{
String username,password;
boolean flag=false;
username=request.getParameter("username");
password=request.getParameter("password");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:padduDB");
java.sql.Statement st = con.createStatement();
ResultSet rs=st.executeQuery("Select * from login");
while(rs.next())
{
if((username.equals(rs.getString("username"))) && (password.equals(rs.getString("password"))))
{
flag=true;
break;
}
else
{
flag=false;
}
}
if(flag)
{
out.println("<script language='javascript'>alert('Login Successful')</script>");
response.sendRedirect("newhome2.jsp");
//out.print("<script language=javascript>alert('"Login Successful"')</script>");
}
else
{
out.println("<script language='javascript'>alert('Login UnSuccessful')</script>");
//out.println("Login Unsuccessful");
}
}
catch(Exception e)
{
out.println(e);
}
}
%>
<input name="cancel" type="submit" id="cancel" value="Cancel">
</div></td>
</tr>
</table>
<p> </p>
</div></td>
</tr>
</table>
</div></td>
</tr>
</table>
<div align="center"></div>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -