📄 adminbusiness.java
字号:
package com.business;
import java.util.Vector;
import java.sql.*;
import com.bean.AdminBean;
import com.db.DBConnection;
import com.struts.form.AdminForm;
public class AdminBusiness implements IBusiness {
public boolean findByName(Object ob)
{
DBConnection dbconn=DBConnection.getDBConnection();
Connection conn=dbconn.getConn();
String sql="select * from admins where aname=? and apass=?";
PreparedStatement ps=null;
ResultSet rst=null;
//AdminBean ab=(AdminBean) ob;
AdminForm ab=(AdminForm) ob;
try {
ps=conn.prepareStatement(sql);
ps.setString(1, ab.getName());
ps.setString(2, ab.getPass());
rst=ps.executeQuery();
if(rst.next())
{
return true;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
try {
if(rst!=null)
{
rst.close();
}
if(ps!=null)
{
ps.close();
}
if(conn!=null)
{
conn.close();
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return false;
}
public boolean delete(String id) {
// TODO Auto-generated method stub
return false;
}
public Object findById(String id) {
// TODO Auto-generated method stub
return null;
}
public boolean save(Object ob) {
// TODO Auto-generated method stub
return false;
}
public boolean update(Object ob) {
// TODO Auto-generated method stub
return false;
}
public Vector findAll() {
// TODO Auto-generated method stub
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -