📄 loginimp.java
字号:
package Biz;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.*;
import java.util.*;
import Dao.*;
import javax.servlet.jsp.jstl.sql.Result;
import java.io.IOException;
import java.lang.Exception;
public class loginImp implements BizInterface {
public String execute(HttpServletRequest request,HttpServletResponse response)
{
String name = (String) request.getParameter("loginName");
String pass = (String) request.getParameter("loginPass");
String path = "";
try
{
Connection conn = ConnectionManage.getConnection();
String sql = "select UserPass from users where UserName = '"+name+"'";
SQLCommandBean sqlCommandBean = new SQLCommandBean();
sqlCommandBean.setConn(conn);
sqlCommandBean.setSqlValue(sql);
Result result = sqlCommandBean.executeQuery();
if(result == null || result.getRowCount() == 0)
{
request.setAttribute("message",new Exception("数据库错误:登陆-没有记录") );
}
else
{
Map m = result.getRows()[0];
String newPass = m.get("UserPass").toString();
if(newPass.equals(pass))
{
path = "show.jsp";
}
}
}
catch(Exception ex)
{
request.setAttribute("message",new Exception("数据库错误:登陆出错了") );
path="message.jsp";
}
return path;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -