|
<%@ page language="java" contentType="text/HTML; charset=GBK"
pageEncoding="GBK"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>登陆首页</title>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<style type="text/css">
.style3 {font-size: 18px; font-weight: bold; color:#003366 }
.style5 {font-size: 15px; font-weight: bold; color:#003366 }
.style7 {font-size: 14px; color:#003366}
.style8 {font-size: 14}
</style>
<script language="javascript" type="text/javascript">
function Login()
{
var name = document.getElementById("name").value;
var password = document.getElementById("password").value;
if(name=="")
{
alert("用户名不能为空!");
return false;
}
if(password=="")
{
alert("密码不能为空!");
return false;
}
}
</script>
</head>
<body>
<%
Object st= request.getParameter("fl");
if(st==null){
%>
<form id="form1" name="form1" method="post" action="login.jsp?fl=1" >
<table width="370" border="1" align="center" cellpadding="0" cellspacing="1" bordercolor="#a2c2ff">
<tr bgcolor="#92b2ff">
<td height="24" colspan="2" align="center" class="style3">用户登陆</td>
</tr>
<tr bgcolor="#a2c2ff">
<td width="104" class="style5">用户名:</td>
<td width="263"><label>
<input type="text" name="name" id="name" size="30" />
</label></td>
</tr>
<tr bgcolor="#a2c2ff">
<td class="style5">密 码:</td>
<td><input type="password" name="password" id="password" size="33"/></td>
</tr>
<tr>
<td colspan="2" align="center" bgcolor="#a2c2ff">
<input type="submit" name="queding" id="queding" value="确定" onclick="returnogin()"/>
<input type="button" name="quxiao" id="quxiao" value="取消" onclick="closeWindows()"/>
</td>
</tr>
</table>
</form>
<%
}else{
System.out.println("登录---");
Object Name=request.getParameter("name");
String name=null;
if(Name!=null&&!Name.equals("")){
name=Name.toString();
}
Object password=request.getParameter("password");
if(name!="tbuser"||!name.equals("tbuser")||password!="tbuser"||!password.equals("tbuser")){ %>
<script>
alert("用户名或密码错误!请从新登陆。");
window.location.href="<%=path %>/login.jsp";
</script>
<%
}else{
session.setAttribute("s","s");
%>
<script>
window.location.href="<%=path %>/s.jsp";
</script>
<% } }%>
</body>
<script type="text/javascript" language="javascript">
function closeWindows(){
window.close();
}
</script>
</html>
调用Javascript会在页面将传输信息,用户通过右击鼠标,查看源文件,显示出来,通过Java代码被编译后将不会显示。 |
|