제가 회원로그인할때


if문으로 회원등급을 관리자,회원 이렇게주고 싶은데  한번봐주시면안될까요?


dao

public boolean loginCheck(String m_id,String pw,String grade){
 boolean  result=false;
 try{
  exschedule m=new exschedule();
  conn=getConnection();
  String sql="select m.m_id,m.pw,g.grade_code from member m,grade g where m.m_id=? and m.pw=? and g.grade_code=? and g.grade_code=m.grade_code";
  pstmt=conn.prepareStatement(sql);
  pstmt.setString(1, m_id);
  pstmt.setString(2, pw);
  pstmt.setString(3, grade);

  rs=pstmt.executeQuery();
  if(rs.next()){
   result=true;
   System.out.println(grade);
  }
 }catch(Exception e){
  e.printStackTrace();
 }finally{
  if(conn!=null)try{conn.close();}catch (Exception e) {e.printStackTrace();}
 }
 return result;
 
 
 
 
 
}




loginpro.jsp

<!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>Insert title here</title>
</head>
<body>


<jsp:useBean id="m" class="yjp.sp.ptc.exschedule"/>
<% 
request.setCharacterEncoding("utf-8");
 String m_id = request.getParameter("m_id");
 String pw = request.getParameter("pw");
 String grade = request.getParameter("grade_code");
 
 joinDAO dao=joinDAO.getInstance();

 boolean result=dao.loginCheck(m_id, pw, grade);
 System.out.print(grade);
 if(result){
  
  session.setAttribute("sessionId",m_id);
  
  session.setAttribute("sessionPw",pw);
  session.setAttribute("grade",grade);
  response.sendRedirect("loginForm.jsp");
  
  
 }else{%>
 <script>
      alert("아이디와 비밀번호를 확인해주세요");
     [removed]("loginForm.jsp");
      </script>
 <%}
 
 
 
%>
</body>
</html>





로그인폼

<%@page import="yjp.sp.ptc.exschedule"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
    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>Insert title here</title>
</head>
<%
String m_id=request.getParameter("m_id");

exschedule e=new exschedule();
request.setCharacterEncoding("utf-8");
if(session.getAttribute("sessionId")==null){
 %>
 <form action="loginPro.jsp">
 id <input type="text" name="m_id" value="slykzzangs"/><br/>
 pw<input type="password" name="pw" value="11111"><br/>
 <input type="submit" value="로그인"><br/>
 
 
 
 </form>
 <% }else{
 String grade_code=request.getParameter("grade_code");
 System.out.println("회원등급"+grade_code);
 %>
 
 <h2>
 
 <%=session.getAttribute("sessionId") %>님 로그인되었습니다.
  
 </h2>
 <input type="button" value="로그아웃" >   <input type="button" value="마이페이지" >   <input type="button" value="스케줄" ><%}
%>

</html>