package demo;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class Login extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = -7352627802883440295L;
public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException{
//如果是Get请求,执行doPost请求
doPost(request, response);
}
public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException{
RequestDispatcher dispatcher = null;
HttpSession session = request.getSession();
//从session中获取验证码
String v_code = (String) session.getAttribute(ValidateCodeHelper.V_CODE);
//从请求中拿到前台提交的验证马
String valiCode = request.getParameter("validateCode");
if(v_code.equalsIgnoreCase(valiCode.trim())){
dispatcher = request.getRequestDispatcher("/success.jsp");
}else{
request.setAttribute("errMsg", "验证码验证失败");
dispatcher = request.getRequestDispatcher("/index.jsp");
}
dispatcher.forward(request, response);
}
}
最近下载更多
lvhongquan LV11
2023年12月30日
a1677596408 LV23
2022年7月1日
fangen0005 LV25
2022年4月23日
welcome丶 LV9
2021年12月30日
ewan007 LV30
2021年10月24日
nnnnny LV1
2021年9月23日
wk61339532 LV7
2021年8月20日
1000-7 LV5
2021年7月2日
浅笑心柔 LV1
2021年6月30日
明123456 LV11
2021年5月27日
最近浏览更多
lvhongquan LV11
2023年12月30日
susitian LV2
2023年12月28日
DongYingdie LV2
2023年12月21日
ds9009 LV8
2023年8月23日
qqwerty LV3
2022年12月12日
陈佳兴 LV4
2022年11月21日
ming_123_9715 LV23
2022年7月19日
a1677596408 LV23
2022年7月1日
2998919365 LV5
2022年5月23日
fangen0005 LV25
2022年4月23日

