<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path;
String username = " ";
String password = " ";
//request.setCharacterEncoding("uft-8");//防止中文乱码
username = request.getParameter("usename");//得到用户名
password = request.getParameter("password");
//如果用户和密码都等于admin则登陆成功 (没用数据库)
if("admin".equals(username) && "admin".equals(password)){
session.setAttribute("loginUser", username);//把用户名放到回话
request.getRequestDispatcher("login_success.jsp").forward(request,response);
//服务器内部转发
}else{
response.sendRedirect("login_failure.jsp");
//请求重定向
}
%>