扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:李炳容 来源:xxol.net 2007年9月2日
关键字:
<%@ page import=" com.testSession, java.util.Vector"%> <%@page contentType="text/html;charset=GBK" %> <% request.setCharacterEncoding(response. getCharacterEncoding());%> <% String actionType=request.getParameter("actiontype"); String actionResult=""; if(actionType!=null) { if(actionType.equals("login")){ // -1- String userName=request.getParameter("username"); if(userName==null || userName.equals("")){ ; } else{ String password=request.getParameter("password"); if(password==null) password=""; testSession ts= (testSession)session.getAttribute("testSession"); if(ts!=null) { //-1.1- session.removeAttribute("testSession"); if( !ts.User.name.equals("")) ts.logout(); } ts=new testSession(); if(!ts.verify(userName,password)) { //验证用户与密码,看是否合法用户 actionResult="login fail"; //非法用户,显示错误信息 } else{ //验证成功 session.setAttribute("testSession",ts); Vector app_vts= (Vector)application.getAttribute("app_vts"); if(app_vts==null) { app_vts=new Vector(); application.setAttribute("app_vts",app_vts); } ts.setSessionVar(session.getId(),app_vts); ts.login(userName); actionResult=userName+" login success"; } } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。