资源简介

基于JSP和mysql的火车票售票系统,采用mvc框架,适合毕业设计参考

资源截图

代码片段和文件信息

package com.trainticket.basedao;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.PreparedStatement;
import java.util.ArrayList;
import java.util.List;


/**

 * @author sunxiaoyong
 *
 */
public class baseDao {

private Connection conn = null;

/**
 * @param sql
 * @return
 */
public boolean executeSql(String sql){
conn = ConnectionDBDao.getConnection();
Statement stmt = null;
try {
stmt = conn.createStatement();
int execRes = stmt.executeUpdate(sql);
if (execRes<=0) {
return false;
}
return true;
} catch (SQLException e) {
e.printStackTrace();
return false;
}finally {     
     try {    
stmt.close();
conn.close();
} catch (SQLException e) {

e.printStackTrace();
}     
    }

}

/**
 * 
 * @param sql
 * @param parameterList
 * @return
 */
public boolean executeSql(String sqlList parameterList){
conn = ConnectionDBDao.getConnection();
PreparedStatement ptmt = null;
try {
ptmt = conn.prepareStatement(sql);
for (int i=0; i ptmt.setobject(i+1 parameterList.get(i));
}

if (ptmt.executeUpdate() <= 0)
return false;
return true;
} catch (SQLException e) {
e.printStackTrace();
return false;
}finally {     
     try {
     ptmt.close();    
     conn.close();

} catch (SQLException e) {

e.printStackTrace();
}     
    }
}

/**
 *
 * @param sql
 * @return
 */
public List executeQuery(String sql){
conn = ConnectionDBDao.getConnection();
Statement stmt = null;
ResultSet rs = null;
try {
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
return this.getList(rs);

} catch (SQLException e) {
e.printStackTrace();
return null;
}finally {     
     try {    
     rs.close();    
     stmt.close();    
     conn.close();
} catch (SQLException e) {
e.printStackTrace();

}     
    }
}

/**
 * 
 * @param sql
 * @param parameterList
 * @return
 */
public Listject> executeQuery(String sqlListject> parameterList){
conn = ConnectionDBDao.getConnection();
PreparedStatement ptmt = null;
ResultSet rs = null;
try {
ptmt = conn.prepareStatement(sql);
for (int i=0; i ptmt.setobject(i+1 parameterList.get(i));
}
rs = ptmt.executeQuery();
return this.getList(rs);
} catch (SQLException e) {
e.printStackTrace();
return null;
}finally {     
     try {
     rs.close();
     ptmt.close();    
     conn.close();
} catch (SQLException e) {

e.printStackTrace();
}     
    }
}

/**
 * 
 * @param rs
 * @return
 */
private Listject> getList(ResultSet rs){

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        462  2009-06-15 14:47  trainticket\.classpath

     文件        306  2009-05-09 23:51  trainticket\.mymetadata

     文件       1229  2009-05-10 15:23  trainticket\.project

     文件       3385  2009-05-11 09:03  trainticket\src\com\trainticket\basedao\baseDao.java

     文件        672  2009-05-11 10:02  trainticket\src\com\trainticket\basedao\ConnectionDBDao.java

     文件       2951  2009-05-24 22:30  trainticket\src\com\trainticket\dao\LeaveWordDao.java

     文件       2638  2009-05-26 15:57  trainticket\src\com\trainticket\dao\OrderInfoDao.java

     文件       4530  2009-05-25 15:36  trainticket\src\com\trainticket\dao\StationCheckInfoDao.java

     文件       3964  2009-05-25 09:53  trainticket\src\com\trainticket\dao\TrainCheckInfoDao.java

     文件       5560  2009-06-15 14:48  trainticket\src\com\trainticket\dao\UserInfoDao.java

     文件       1166  2009-05-11 23:04  trainticket\src\com\trainticket\filter\LoginFilter.java

     文件       1650  2009-05-11 23:04  trainticket\src\com\trainticket\filter\SetCharacterEncodingFilter.java

     文件       1605  2009-05-24 22:26  trainticket\src\com\trainticket\javabean\LwordInfoBean.java

     文件       1952  2009-05-26 13:03  trainticket\src\com\trainticket\javabean\OrderBean.java

     文件        757  2009-05-13 00:39  trainticket\src\com\trainticket\javabean\PassBean.java

     文件        812  2009-05-13 00:39  trainticket\src\com\trainticket\javabean\PriceBean.java

     文件        727  2009-05-13 00:38  trainticket\src\com\trainticket\javabean\SeatBean.java

     文件        936  2009-05-11 09:42  trainticket\src\com\trainticket\javabean\StationBean.java

     文件       1226  2009-06-15 14:48  trainticket\src\com\trainticket\javabean\TicketBean.java

     文件       1711  2009-05-13 00:37  trainticket\src\com\trainticket\javabean\TrainBean.java

     文件       1929  2009-05-26 15:27  trainticket\src\com\trainticket\javabean\UserInfoBean.java

     文件       7845  2009-05-25 15:38  trainticket\src\com\trainticket\servlet\CheckTicketServlet.java

     文件       4639  2009-05-19 15:04  trainticket\src\com\trainticket\servlet\LeaveWordServlet.java

     文件       5714  2009-06-13 01:20  trainticket\src\com\trainticket\servlet\OrderTicketServlet.java

     文件       7696  2009-05-26 22:46  trainticket\src\com\trainticket\servlet\UserServlet.java

     文件       3388  2009-05-15 16:05  trainticket\src\com\trainticket\util\DateFormat.java

     文件       3075  2009-05-15 16:16  trainticket\src\com\trainticket\util\DateOperation.java

     文件       1513  2009-05-18 22:38  trainticket\src\com\trainticket\util\DateParse.java

     文件       4195  2009-05-26 14:20  trainticket\WebRoot\admin_manage\Login.jsp

     文件       2917  2009-05-27 09:42  trainticket\WebRoot\admin_manage\OrderInfo.jsp

............此处省略128个文件信息

评论

共有 条评论