</pre><div align="left"><pre name="code" class="javascript">
jsp登录界面部分代码展示:
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'login.jsp' starting page</title>
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript">
function chkData(){
//var myuname = document.getElementById("uname").value;
if(frm.uname.value==""){
alert("用户名不能为空。");
return false;
}
else if(frm.upass.value==""){
alert("密码不能为空.");
return false;
}else{
return true;
}
}
</script>
</head>
<body>
<form name="frm" method="get" action="doLogin.jsp">
<table align="center" border="1">
<tr>
<td>用户名:</td>
<td><input type="text" name="uname" id="uname"/></td>
</tr>
<tr>
<td>密 码:</td>
<td><input type="password" name="upass" id="upass"/></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="提交" οnclick="return chkData();"/>
<input type="reset" value="重置"/>
</td>
</tr>
</table>
</form>
</body>
</html>