);
if(n==1)
{
return true;
} else {
return false;
}
}catch(sqlexception e){
e.printstacktrace();
throw e;
}finally{
db.closers(rs);
db.closepstmt(pstmt);
db.closeconn(conn);
}
}
本系统的教师登录模块采用了固定的用户名和密码。为实现它,我创建了一个adminloginaction类,调用adminmanager类中的方法:
public boolean validate(string name, string password)
{
if (("admin".equals(name))&&("admin".equals(password)))
{
system.out.print("正确!");
return true;
}else
{
system.out.print("错了");
return false;
}
}
如果教师输入的用户名或密码有误则会有提示:"用户名或密码不匹配,请重新登录!"接着页面会跳到教师登录页面。
鉴于对系统安全的考虑,用户使用系统必须先到登录页面进行身份验证,通过登录窗口用户输入用户名和密码,只有输入正确的用户名和密码后用户才能进入系统。
下图页面是学生登录的首页如图6-2:

图6-2用户登录页面
教师登录页面如图6-3所示:

图6-3教师登录页面
6.2.3 电子教案管理模块
a.电子教案管理模块分为学生用户主页的电子教案管理和教师用户主页的电子教案管理。教师成功登录后,在教师用户主页中的电子教案管理模块,教师可以上传新电子教案,也可以删除以前传过的旧电子教案。点击“上传电子教案”就会进入到电子教案上传的页面,教师点击“浏览”选择要上传的电子教案,然后点上传就完成了一个电子教案的上传。创建了一个继承于dispatchaction的uploadaction类,该类用于上传和下载文件。关键代码如下:
uploadform uploadfile = (uploadform)form;
formfile file = uploadfile.getfile();
string uuidname = uuid.randomuuid().tostring();
string kejian_name = uuidname+file.getfilename();
string kejian_time =uploadfile.getkejian_time();
servletcontext servletcontext = this.getservlet().getservletcontext();
string path = servletcontext.getrealpath("");
fileoutputstream out = new fileoutputstream(path+"/uploadc/"+ kejian_name);
out.write(file.getfiledata());
out.flush();
out.close();
uploadmanager ul
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>