<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030" import="java.sql.*"%> Insert title here <% String username=new String(request.getParameter("username").getBytes("ISO-8859-1"),"GB18030"); String password=new String(request.getParameter("password").getBytes("ISO-8859-1"),"GB18030"); String quanxian=new String(request.getParameter("quanxian").getBytes("ISO-8859-1"),"GB18030"); Connection con=guanli.getCon(); if(quanxian.equals("管理员")){ String sql="select * from login where username='"+username+"' and password='"+password+"'"; ResultSet rs=guanli.GetRs(sql); if(rs.next()){ //session.setAttribute("jibie",""+quanxian+""); session.setAttribute("guanliyuan",""+username+""); out.println(""); } else{ out.println(""); } guanli.closed(); } if(quanxian.equals("用户")){ String sql="select * from reg where username='"+username+"' and password='"+password+"'"; ResultSet rs=guanli.GetRs(sql); if(rs.next()){ //session.setAttribute("bianhao",""+rs.getString("bianhao")+""); session.setAttribute("ck",""+username+""); out.println(""); } else{ out.println(""); } guanli.closed(); } %>