大概要mvc模型吧,用javabean做数据库操作
还有Login.java 和DataBean.java的代码不会.
谁能给个猜考一下
以下是login.htm的代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>首页</title>
<script type="text/javascript">
var xmlHttp;
//创建httpRequest请求
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function userNameCheck() {
var userName = document.getElementById("userName").value;
if(userName == "") {
window.alert("用户名不能为空.");
document.form1.userName.focus();
return false;
}
else {
var url = "Login?userName=" + userName + "&ts=" + new Date().getTime();
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleAddStateChange;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
}
function handleAddStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200 || xmlHttp.status == 0) {
var mes = xmlHttp.responseXML.getElementsByTagName("message")[0].firstChild.data;
var val = xmlHttp.responseXML.getElementsByTagName("passed")[0].firstChild.data;
setMessage(mes, val);
}
else {
alert(xmlHttp.status);
alert("Error while adding employee.");
}
}
}
function setMessage(message, isValid) {
var messageArea = document.getElementById("showMessage");
var fontColor = "red";
if (isValid == "true") {
fontColor = "green";
}
messageArea.innerHTML = "<font color=" + fontColor + ">" + message + " </font>";
}
</script>
</head>
<body>
<center>
<br /><br />
<table>
<form action="#" name="form1">
用户名: <input type="text" size="15" name="userName" onblur="userNameCheck();" id="userName"/>
<a href="reg?action=reg">注册</a><br />
密 码:<input type="password" size="15" name="usePassword" id="password"/><br />
<input type="button" value="登录" name="submit" />
</form>
<div id="showMessage"></div>
</table>
</center>
</body>
</html>