?? login.java
字號:
package data;
import java.io.IOException;
import java.sql.SQLException;
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 = 2315156614289693989L;
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html; charset=GBK");
try {
java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("MMddHHmmss");
java.util.Date Now=new java.util.Date(new java.util.Date().getTime());
String dltime=formatter.format(Now);
String id = request.getParameter("id");
String password = request.getParameter("password");
DBConnectionBean db = new DBConnectionBean();
if (id.length()!=0&&password.length()!=0&&db.checkplay(id, password)) {
HttpSession session = request.getSession();
session.setAttribute("id", id);
session.setAttribute("dltime", dltime);
response.sendRedirect("index.jsp");
}else{
HttpSession session = request.getSession();
session.setAttribute("id", id);
session.setAttribute("password", password);
response.sendRedirect("jump/loginerror.jsp");
}
}catch (SQLException e) {
System.out.println(e.getMessage());
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -