資源簡介
JSP學(xué)生信息管理系統(tǒng),有數(shù)據(jù)庫,代碼詳細(xì),分為管理員和學(xué)生兩個(gè)部分。

代碼片段和文件信息
package?dao;
import?java.sql.*;
import?java.util.ArrayList;
import?java.util.List;
import?model.Admin;
import?model.Student;
import?util.DB;
public?class?AdminDao?{
?Connection?con=null;
?Statement?stmt=null;
?ResultSet?rs=null;
?PreparedStatement?ps=null;
//?查詢主鍵是否已存在
public??int?count(String?condition){
ResultSet?rs=null;
con=DB.getConnection();
int?c=0;
try?{
stmt=con.createStatement();
rs=stmt.executeQuery(“select?count(*)?from?admin?“+condition);
rs.next();
c=rs.getInt(1);
}?catch?(SQLException?e)?{
//?TODO?自動(dòng)生成?catch?塊
e.printStackTrace();
}
DB.close(rs);
DB.close(stmt);
DB.close(con);
return?c;
}
public??boolean?isExist(String?id){
ResultSet?rs=null;
con=DB.getConnection();
try?{
stmt=con.createStatement();
rs=stmt.executeQuery(“select?*?from?admin?where?id?=?‘“+id+“‘“);
}?catch?(SQLException?e)?{
//?TODO?自動(dòng)生成?catch?塊
e.printStackTrace();
}
boolean?yes=true;
try?{
while(rs.next()){
yes=false;
}
}?catch?(SQLException?e)?{
//?TODO?自動(dòng)生成?catch?塊
e.printStackTrace();
}
DB.close(rs);
DB.close(stmt);
DB.close(con);
return?yes;
}
//查詢
public??Admin?quaryById(String?id){
ResultSet?rs=null;
Admin?s=null;
con=DB.getConnection();
try?{
stmt=con.createStatement();
rs=stmt.executeQuery(“select?*?from?admin?where?id?=?‘“+id+“‘“);
}?catch?(SQLException?e)?{
//?TODO?自動(dòng)生成?catch?塊
e.printStackTrace();
}
try?{
if(rs.next()){
s=new?Admin();
s.setId(rs.getString(1));
s.setName(rs.getString(2));
s.setPassword(rs.getString(3));
}
}?catch?(SQLException?e)?{
//?TODO?自動(dòng)生成?catch?塊
e.printStackTrace();
}
DB.close(rs);
DB.close(stmt);
DB.close(con);
return?s;
}
public??List?quary(String?sql){
ResultSet?rs=null;
List?list=new?ArrayList();
con=DB.getConnection();
try?{
stmt=con.createStatement();
rs=stmt.executeQuery(sql);
}?catch?(SQLException?e)?{
//?TODO?自動(dòng)生成?catch?塊
e.printStackTrace();
}
try?{
while(rs.next()){
Admin?s=new?Admin();
s.setId(rs.getString(1));
s.setName(rs.getString(2));
s.setPassword(rs.getString(3));
list.add(s);
}
}?catch?(SQLException?e)?{
//?TODO?自動(dòng)生成?catch?塊
e.printStackTrace();
}
DB.close(rs);
DB.close(stmt);
DB.close(con);
return?list;
}
//插入
public??int?insert(Admin?s){
con=DB.getConnection();
int?i=0;
try?{
ps=con.prepareStatement(“insert?into?admin?values?(???)“);
ps.setString(1?s.getId());
ps.setString(2?s.getName());
ps.setString(3?s.getPassword());
i=ps.executeUpdate();
}?catch?(SQLException?e)?{
//?TODO?自動(dòng)生成?catch?塊
e.printStackTrace();
}
DB.close(ps);
DB.close(con);
return?i;
}
//刪除
public??int?delete(Admin?s){
con=DB.getConnection();
int?i=0;
try?{
ps=con.prepareSt
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????362??2013-04-17?01:07??week11_studentsystem\.classpath
?????文件????????334??2013-05-15?09:02??week11_studentsystem\.myme
?????文件???????1426??2013-05-15?09:01??week11_studentsystem\.project
?????文件????????847??2013-05-06?11:05??week11_studentsystem\WebRoot\error.jsp
?????文件???????1989??2013-05-15?12:03??week11_studentsystem\WebRoot\login.jsp
?????文件???????2021??2013-05-15?10:28??week11_studentsystem\WebRoot\regist.jsp
?????文件???????3833??2013-05-15?12:03??week11_studentsystem\WebRoot\WEB-INF\web.xm
?????文件???????1544??2013-05-15?09:01??week11_studentsystem\WebRoot\WEB-INF\classes\util\DB.class
?????文件???????1720??2013-05-15?09:01??week11_studentsystem\WebRoot\WEB-INF\classes\util\DB2.class
?????文件???????1321??2013-05-15?09:01??week11_studentsystem\WebRoot\WEB-INF\classes\servlet\Exit.class
?????文件???????2749??2013-05-15?11:01??week11_studentsystem\WebRoot\WEB-INF\classes\servlet\Login.class
?????文件???????2782??2013-05-15?10:30??week11_studentsystem\WebRoot\WEB-INF\classes\servlet\student\Regist.class
?????文件???????1761??2013-05-15?10:18??week11_studentsystem\WebRoot\WEB-INF\classes\servlet\admin\Delete.class
?????文件???????2036??2013-05-15?10:19??week11_studentsystem\WebRoot\WEB-INF\classes\servlet\admin\Insert.class
?????文件???????1796??2013-05-15?10:19??week11_studentsystem\WebRoot\WEB-INF\classes\servlet\admin\Update.class
?????文件????????872??2013-05-15?09:01??week11_studentsystem\WebRoot\WEB-INF\classes\model\Admin.class
?????文件???????1077??2013-05-15?09:34??week11_studentsystem\WebRoot\WEB-INF\classes\model\Student.class
?????文件???????1399??2013-05-15?09:01??week11_studentsystem\WebRoot\WEB-INF\classes\filter\EncodingFitler.class
?????文件???????1689??2013-05-15?11:58??week11_studentsystem\WebRoot\WEB-INF\classes\filter\UserFilter.class
?????文件???????4460??2013-05-15?09:01??week11_studentsystem\WebRoot\WEB-INF\classes\dao\AdminDao.class
?????文件???????4625??2013-05-15?09:37??week11_studentsystem\WebRoot\WEB-INF\classes\dao\StudentDao.class
?????文件???????1207??2013-05-15?11:28??week11_studentsystem\WebRoot\student\index.jsp
?????文件????????848??2013-05-15?09:52??week11_studentsystem\WebRoot\student\modifypassword.jsp
?????文件????????840??2013-05-15?09:51??week11_studentsystem\WebRoot\student\update.jsp
?????文件????????412??2013-04-17?01:07??week11_studentsystem\WebRoot\me
?????文件?????????36??2013-04-17?01:07??week11_studentsystem\WebRoot\me
?????文件???????4467??2013-05-15?11:00??week11_studentsystem\WebRoot\admin\index.jsp
?????文件???????2042??2013-05-13?08:55??week11_studentsystem\WebRoot\admin\insertform.jsp
?????文件???????2471??2013-05-15?09:43??week11_studentsystem\WebRoot\admin\updateform.jsp
?????文件???????1371??2013-04-17?01:07??week11_studentsystem\src\util\DB.java
............此處省略50個(gè)文件信息
評(píng)論
共有 條評(píng)論