diff --git a/src/javabean/db_conn.java b/src/javabean/db_conn.java index c370afe..980cd5f 100644 --- a/src/javabean/db_conn.java +++ b/src/javabean/db_conn.java @@ -13,7 +13,7 @@ public class db_conn { //数据库初始化连接 public db_conn() { - String URL="jdbc:mysql://localhost:3307/fly_ticket?useSSL=false&useUnicode=true&characterEncoding=UTF8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC"; //数据库名3306 + String URL="jdbc:mysql://localhost:3306/fly_ticket?useSSL=false&useUnicode=true&characterEncoding=UTF8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC"; //数据库名3306 String USER="root"; //数据库用户名 String PWD="123456"; //数据库密码 try{ diff --git a/src/javabean/flight.java b/src/javabean/flight.java index a5c4fd9..363a8b2 100644 --- a/src/javabean/flight.java +++ b/src/javabean/flight.java @@ -8,8 +8,35 @@ public class flight { // private String f_s_t=null;//起飞时间 private String f_a_t=null;//到达时间 private String f_p=null;//票价 + private String f_d=null;//出发日期 + private String f_delay=null;//延误率 + private String f_food=null;//餐食情况 + private String f_wide=null;//座位宽度 - + public String getF_wide() { + return f_wide; + } + public void setF_wide(String f_wide) { + this.f_wide=f_wide; + } + public String getF_food() { + return f_food; + } + public void setF_food(String f_food) { + this.f_food=f_food; + } + public String getF_delay() { + return f_delay; + } + public void setF_delay(String f_delay) { + this.f_delay=f_delay; + } + public String getF_d() { + return f_d; + } + public void setF_d(String f_d) { + this.f_d=f_d; + } public String getF_n() { return f_n; } diff --git a/src/servlet/search_fly.java b/src/servlet/search_fly.java index 97c07b8..07fab82 100644 --- a/src/servlet/search_fly.java +++ b/src/servlet/search_fly.java @@ -41,7 +41,7 @@ public class search_fly extends HttpServlet { String sql = null; if (departure.isEmpty() && destination.isEmpty() && departureYear.isEmpty() && departureMonth.isEmpty() && departureDay.isEmpty()) { - // 濡傛灉鎵鏈夊瓧娈甸兘涓虹┖锛岄噸瀹氬悜鍒板師椤甸潰 + // 婵″倹鐏夐幍锟介張澶婄摟濞堢敻鍏樻稉铏光敄閿涘矂鍣哥规艾鎮滈崚鏉垮斧妞ょ敻娼 resp.sendRedirect(url); } else { sql = "SELECT * FROM flight WHERE 1=1"; @@ -53,7 +53,7 @@ public class search_fly extends HttpServlet { sql += " AND f_a_p='" + destination + "'"; } if (!departureYear.isEmpty() && !departureMonth.isEmpty() && !departureDay.isEmpty()) { - // 楠岃瘉鏃ユ湡鏍煎紡 + // 妤犲矁鐦夐弮銉︽埂閺嶇厧绱 try { int year = Integer.parseInt(departureYear); int month = Integer.parseInt(departureMonth); @@ -62,10 +62,10 @@ public class search_fly extends HttpServlet { String departureDate = String.format("%04d-%02d-%02d", year, month, day); sql += " AND DATE(f_Date)='" + departureDate + "'"; } else { - req.setAttribute("errorMsg", "鏃ユ湡鏍煎紡涓嶆纭紝璇疯緭鍏ユ湁鏁堢殑骞淬佹湀銆佹棩"); + req.setAttribute("errorMsg", "閺冦儲婀¢弽鐓庣础娑撳秵顒滅涵顕嗙礉鐠囩柉绶崗銉︽箒閺佸牏娈戦獮娣拷浣规箑閵嗕焦妫"); } } catch (NumberFormatException e) { - req.setAttribute("errorMsg", "鏃ユ湡鏍煎紡涓嶆纭紝璇疯緭鍏ユ暟瀛"); + req.setAttribute("errorMsg", "閺冦儲婀¢弽鐓庣础娑撳秵顒滅涵顕嗙礉鐠囩柉绶崗銉︽殶鐎涳拷"); } } @@ -84,11 +84,15 @@ public class search_fly extends HttpServlet { flight_info.setF_s_t(res.getString(6)); flight_info.setF_a_t(res.getString(7)); flight_info.setF_p(res.getString(8)); + flight_info.setF_d(res.getString(9)); + flight_info.setF_delay(res.getString(10)); + flight_info.setF_food(res.getString(11)); + flight_info.setF_wide(res.getString(12)); flightlist.add(flight_info); } req.setAttribute("flightlist", flightlist); } catch (SQLException e) { - System.out.println("閿欒淇℃伅锛" + e); + System.out.println("闁挎瑨顕ゆ穱鈩冧紖閿涳拷" + e); } finally { conn.closeDB(); }