我总是在下面的代码中转到ELSE
语句:
if (session == null) {
request.setAttribute("stts_log", "Login");
request.setAttribute("btn_modal", "exambutton");
request.setAttribute("btn_href", "#");
out.print("Please login first");
RequestDispatcher rd=request.getRequestDispatcher("index2.jsp");
rd.forward(request, response);
} else {
request.setAttribute("sess", session);
request.setAttribute("stts_log", "Logout");
request.setAttribute("btn_modal", "");
request.setAttribute("btn_href", "ControllerServlet");
RequestDispatcher rd=request.getRequestDispatcher("index2.jsp");
rd.forward(request, response);
}