資源簡介
內含配置說明書
本系統采用Microsoft SQLServer2000作為數據庫服務器
要運行本系統,還需要一個JSP容器或者java應用服務器,這里以Weblogic8.1為例介紹如何配置。

代碼片段和文件信息
package?com.csbook.documentsystem;
import?javax.naming.*;
import?javax.sql.*;
import?java.sql.*;
import?java.util.*;
/**
?*?title:?
?*?Description:?
?*?Copyright:?Copyright?(c)?2003
?*?Company:?
?*?@author?not?attributable
?*?@version?1.0
?*/
public?class?BorrowMan{
??Context?ctx?=?null;
??DataSource?ds?=?null;
??SysLog?log?=?null;
??ChangeEncoding?ce=null;
???//構造函數
??public?BorrowMan()?{
????//從連接池中獲取數據庫連接
????try?{
??????ctx?=?new?InitialContext();
??????ds?=?(DataSource)ctx.lookup(“documents“);
????}
????catch?(NamingException?e)?{
??????e.printStackTrace();
????}
????log?=?new?SysLog();
????ce=new?ChangeEncoding();
??}
?//借閱檔案
??public?void?borrowDocument(int?doc?String?borrower
????????????????????????????String?begintime?String?endtime?String?reason)?{
????Connection?con?=?null;
????PreparedStatement?ps?=?null;
????DocMan?dMan=new?DocMan();
????String?docName=dMan.getDocNameById(doc);
????if?(this.getBorrowStateById(doc)?==?1){
??????log.addMsg(“system“?borrower?“您所申請借閱的“?+?docName?+?“已被別人借閱,請稍候時日“?1);
????}
????else?{
??????try?{
????????String?strInsert?=?“insert?into?borrowRecord(documentborrowerbegintimeendtimereasonstate)?values(??????)“;
????????con?=?ds.getConnection();
????????ps?=?con.prepareStatement(strInsert);
????????ps.setInt(1?doc);
????????ps.setString(2?borrower);
????????ps.setString(3?begintime);
????????ps.setString(4?endtime);
????????ps.setString(5ce.changeCharset(reason));
????????ps.setInt(6?0);
????????ps.executeUpdate();
????????log.addMsg(“system“?borrower?“您借閱“?+?docName?+?“的申請已經提交,等待批準“?1);
??????}
??????catch?(SQLException?e)?{
????????e.printStackTrace();
??????}
??????finally?{
????????if?(ps?!=?null)?try?{ps.close();}
?????????catch?(SQLException?ignore)?{}
????????if?(con?!=?null)try{?con.close();}
??????????catch?(SQLException?ignore)?{}
??????}
????}
??}
???//根據檔案編號獲取該檔案的借閱信息
??public?Hashtable?getBorrowInfo(int?borrowId)?{
????Connection?con?=?null;
????PreparedStatement?ps?=?null;
????ResultSet?rs?=?null;
????Hashtable?borrows?=?new?Hashtable();
????try?{
??????String?strQuery?=?“select?*?from?borrowRecord?where?id=?“;
??????con?=?ds.getConnection();
??????ps?=?con.prepareStatement(strQuery);
??????ps.setInt(1?borrowId);
??????rs?=?ps.executeQuery();
??????String?temp;
??????Integer?temp1;
??????if?(rs.next())?{
????????borrows.put(“document“(new?Integer(rs.getInt(“document“)).toString()));
????????borrows.put(“borrower“?rs.getString(“borrower“));
????????borrows.put(“begintime“?rs.getString(“begintime“));
????????borrows.put(“endtime“?rs.getString(“endtime“));
????????temp1=new?Integer(rs.getInt(“state“));
????????borrows.put(“state“?temp1.toString());
????????temp=rs.getString(“lender“);
????????if(temp==null||temp.equals(““))
??????????borrows.put(“lender““?“);
????????else
??????????borrows.put(“lender“temp);
????????borrows.put(“reason“c
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????309248??2004-04-15?16:56??ch05\檔案管理系統配置說明.doc
?????文件??????10215??2004-03-20?18:21??ch05\源代碼\DocumentSystem\defaultroot\action.jsp
?????文件???????2622??2003-12-06?17:15??ch05\源代碼\DocumentSystem\defaultroot\addDocument.jsp
?????文件???????2120??2003-12-06?16:58??ch05\源代碼\DocumentSystem\defaultroot\addlibinfo.jsp
?????文件???????1690??2004-03-20?18:03??ch05\源代碼\DocumentSystem\defaultroot\changeDept.jsp
?????文件????????757??2003-12-06?16:58??ch05\源代碼\DocumentSystem\defaultroot\default.htm
?????文件???????1423??2004-03-20?18:32??ch05\源代碼\DocumentSystem\defaultroot\deptMan.jsp
?????文件???????2624??2003-12-08?14:42??ch05\源代碼\DocumentSystem\defaultroot\docba
?????文件???????4004??2003-12-06?16:58??ch05\源代碼\DocumentSystem\defaultroot\docinfo.jsp
?????文件???????3207??2004-03-19?16:33??ch05\源代碼\DocumentSystem\defaultroot\doclist.jsp
?????文件???????2577??2003-12-06?16:58??ch05\源代碼\DocumentSystem\defaultroot\docsearch.jsp
?????文件???????1779??2003-12-06?16:58??ch05\源代碼\DocumentSystem\defaultroot\docSearchResult.jsp
?????文件????????198??2004-03-19?10:07??ch05\源代碼\DocumentSystem\defaultroot\err.jsp
?????文件????????704??2004-03-19?10:03??ch05\源代碼\DocumentSystem\defaultroot\index.jsp
?????文件???????2808??2003-12-29?19:49??ch05\源代碼\DocumentSystem\defaultroot\libinfo.jsp
?????文件???????3179??2004-03-19?16:54??ch05\源代碼\DocumentSystem\defaultroot\liblist.jsp
?????文件????????693??2004-03-19?10:16??ch05\源代碼\DocumentSystem\defaultroot\login.jsp
?????文件????????256??2003-12-06?16:58??ch05\源代碼\DocumentSystem\defaultroot\logout.jsp
?????文件???????1006??2003-12-06?16:58??ch05\源代碼\DocumentSystem\defaultroot\menu.jsp
?????文件???????1341??2003-12-06?16:58??ch05\源代碼\DocumentSystem\defaultroot\myRecord.jsp
?????文件????????428??2004-03-19?17:11??ch05\源代碼\DocumentSystem\defaultroot\right.jsp
?????文件????????384??2003-12-01?13:16??ch05\源代碼\DocumentSystem\defaultroot\tools.js
?????文件????????491??2004-03-19?09:29??ch05\源代碼\DocumentSystem\defaultroot\top.jsp
?????文件???????2590??2004-03-19?17:19??ch05\源代碼\DocumentSystem\defaultroot\userMan.jsp
?????文件????????179??2004-03-20?18:34??ch05\源代碼\DocumentSystem\defaultroot\WEB-INF\web.xm
?????文件????????179??2003-12-04?20:44??ch05\源代碼\DocumentSystem\defaultroot\WEB-INF\web.xm
?????文件????????179??2003-12-29?11:44??ch05\源代碼\DocumentSystem\defaultroot\WEB-INF\web.xm
?????文件????????179??2003-12-29?12:06??ch05\源代碼\DocumentSystem\defaultroot\WEB-INF\web.xm
?????文件????????210??2004-03-20?18:34??ch05\源代碼\DocumentSystem\defaultroot\WEB-INF\weblogic.xm
?????文件????????464??2003-12-04?20:44??ch05\源代碼\DocumentSystem\defaultroot\WEB-INF\weblogic.xm
............此處省略47個文件信息
- 上一篇:jsp動態論壇+后臺+界面+模版
- 下一篇:將一段文字轉化為哈夫曼編碼JAVA實現
評論
共有 條評論