求教高手!!!!!!
下面是我写的一个简单登录界面:用户名和密码都保存在文件中。。。。不知道为什么实现不了啊:帮帮我把。。。。非常感谢。。。。。。
<%@page contentType="text/html" import="java.io.*"%>
<%@page pageEncoding="UTF-8"%>
<!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=UTF-8">
<title>简单的用户登录界面</title>
</head>
<body>
<form>
<table border="1" cellspacing="1" cellpadding="4" width="80%" align="center">
<tr bgcolor="pink"><td colspan="2"><font color="blue">会员登录</font></td></tr>
<tr><td width="21%">用户名:</td>
<td width="59"><input type="text" name="username"></td></tr>
<tr><td width="21%">密码:</td>
<td width="59"><input type="password" name="usercode"></td></tr>
</table>
<center><input type="submit" name="loginsubmit" value="会员登录"></center>
</form>
<% String username=request.getParameter("username");
String usercode=request.getParameter("usercode");
try{
File f=new File("E:\\users","student.txt");
FileInputStream in=new FileInputStream(f);
DataInputStream DataIn=new DataInputStream(in);
String name="ok",code="ok";
while((name=DataIn.readUTF())!=null){
code=DataIn.readUTF();
if(username==name&&usercode==code)
out.print("Log In Successly");
}DataIn.close();
}
catch(IOException ee){}%>
</body>
</html>