1.jsp的radio情况:
<input type="radio" value="0" name="role"/><strong style="color:black">辅导员</strong>
<input type="radio" value="1" name="role" checked="checked"/><strong style="color:black">学生</strong>
2.servlet的情况(贴关键代码):
boolean b=false;
boolean b1=false;
String[]role=request.getParameterValues("role");//判断是辅导员还是学生
for(int i=0;i<role.length;i++) {
if(role[i].equals("0")) {//辅导员登录
b1=itb.select(username, password);
}else {
b=igb.select(username, password);//学生登录
}
}
if(b==true) {
response.sendRedirect("student/student.jsp");
}else if(b1==true){
response.sendRedirect("teacher.jsp");
}else{
response.sendRedirect("error.jsp");
}