MyException - 我的异常网
当前位置:我的异常网» Java Web开发 » struts 登录怎样alert出异常信息出来呢

struts 登录怎样alert出异常信息出来呢(2)

www.MyException.Cn  网友分享于:2013-12-06  浏览:692次

String usergrade = " ";
validate=dao.ByUsernameQueryValidate(username);
if(dao.ValidatePwd(username, userpwd)==1&&!validate.equals( "离职 ")){
session.setAttribute( "username ", username);
list = dao.ByUsernameQueryUser(username);
if(list!=null&&list.size()!=0){
User uo = (User)list.get(0);
realname = uo.getRealname();
departmentname = ddao.findColumnById(uo.getDepartmentid());
post = pdao.findPostById(uo.getPostid());
usergrade = uo.getUsergrade();
}
session.setAttribute( "realname ", realname);
session.setAttribute( "departmentname ", departmentname);
session.setAttribute( "post ", post);
dao.Loginnum(username);
try {
PrintWriter out = null;
out = response.getWriter();
out.print( " <script> ");
out.print( "document.location.href= 'index.do '; ");
out.print( " </script> ");
out.flush();
} catch (IOException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
// return mapping.findForward( "success ");
return null;
}else{
PrintWriter out = null;
try {
out = response.getWriter();
out.print( " <script> ");
out.print( "alert( '用户名或密码错误或您未通过验证,请重新登录! '); ");
out.print( "window.open( 'login.jsp ', '_self '); ");
out.print( " </script> ");
out.flush();
} catch (IOException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
return null;
}
}

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有