import java.io.IOException;
import java.io.PrintWriter;
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 check extends HttpServlet {
/**
* Constructor of the object.
*/
public check() {
super();
}
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
request.setCharacterEncoding("gb2312");
response.setCharacterEncoding("gb2312");
HttpSession hs=request.getSession();
PrintWriter out = response.getWriter();
String username=request.getParameter("username");
String password=request.getParameter("password");
String code=request.getParameter("code");
String scode=(String) hs.getAttribute("rand");
System.out.println("++++++++++++++++++++++="+scode);
if(!code.equals(scode)){
out.println("验证码错误");
}else if(username.equals("123")&&password.equals("123")){
out.println("进去了!");
}
out
.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>");
out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
}
/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request,response);
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occure
*/
public void init() throws ServletException {
// Put your code here
}
}
etimechen
- 粉丝: 17
- 资源: 5
最新资源
- 带载流子密度的双温模型matlab,电子晶格温度,电子密度,飞秒激光源模拟,有限元法解偏微分方程 德鲁德模型,带载流子密度变化
- GP026-仓库系统.zip
- HttpCanary_3.3.6.apk
- 线控制动系统仿真 Carsim和Simulink联合仿真线控制动系统BBW-EMB系统 包含简单的制动力分配和四个车轮的线控制动机构 四个车轮独立BLDCM三环PID闭环制动控制,最大真实还原线
- Comsol脉冲涡流无损检测仿真 图一:脉冲涡流仿真,检出电压信号 图二:脉冲涡流模型 图三:磁通密度模 图四:磁通密度模
- CC2530无线zigbee裸机代码实现光敏和热敏传感器数值读取.zip
- CC2530无线zigbee裸机代码实现继电器的控制.zip
- CC2530无线zigbee裸机代码实现看门口狗Watch Dog使用.zip
- CC2530无线zigbee裸机代码实现控制步进电机正反转.zip
- CC2530无线zigbee裸机代码实现人体红外传感器数值读取.zip
- CC2530无线zigbee裸机代码实现睡眠定时器唤醒系统.zip
- CC2530无线zigbee裸机代码实现外部中断控制LED开关.zip
- CC2530无线zigbee裸机代码实现外部中断控制流水灯.zip
- 基于51单片机的污水处理厂气体检测报警系统(protues仿真)-毕业设计
- CC2530无线zigbee裸机代码实现温度传感器DS18B20数值读取.zip
- CC2530无线zigbee裸机代码实现温湿度传感器DHT11数值读取.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈