?? 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 + -