?? loginservlet.java
字號(hào):
package com.ideas.servlet;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import com.ideas.util.Configuration;
import com.ideas.bean.userBean;
import java.util.*;
public class LoginServlet
extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res) throws
IOException, ServletException {
String name = req.getParameter("sUserName");
String password = req.getParameter("sPassword");
userBean myBean = new userBean();
myBean.getMyConnPool();
String id = myBean.login(name,password);
String go = "";
if (!id.equals("-1")) {
HttpSession session = req.getSession(true);
session.setAttribute("login", "true");
session.setAttribute("user",name);
go = "index.jsp";
}
else {
go = "login.jsp";
}
myBean.releaseMyConnPool();
res.sendRedirect(go);
}
public void doPost(HttpServletRequest req, HttpServletResponse res) throws
IOException, ServletException {
doGet(req, res);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -