parent
22050ebd56
commit
06c2fd3d81
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk21">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
|
||||
<classpathentry kind="lib" path="D:/apache-tomcat-9.0.87-windows-x64/apache-tomcat-9.0.87/lib/jsp-api.jar"/>
|
||||
<classpathentry kind="lib" path="D:/apache-tomcat-9.0.87-windows-x64/apache-tomcat-9.0.87/lib/servlet-api.jar"/>
|
||||
<classpathentry kind="lib" path="D:/apache-tomcat-9.0.87-windows-x64/apache-tomcat-9.0.87/lib/tomcat-api.jar"/>
|
||||
<classpathentry kind="lib" path="D:/college/SE2/jar_files/mysql-connector-java-8.0.16.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="D:/college/SE2/jar_files/json-20240303.jar"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jdk21" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/classes" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>air_ticket_book</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="WebContent"/>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
|
||||
<attributes>
|
||||
<attribute name="hide" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
|
||||
<classpathentry kind="output" path=""/>
|
||||
</classpath>
|
@ -0,0 +1,11 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="air_ticket_book">
|
||||
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
|
||||
<property name="java-output-path" value="/air_ticket_book/build/classes"/>
|
||||
<property name="context-root" value="air_ticket_book"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<fixed facet="jst.web"/>
|
||||
<fixed facet="wst.jsdt.web"/>
|
||||
<fixed facet="java"/>
|
||||
<installed facet="java" version="1.8"/>
|
||||
<installed facet="jst.web" version="3.0"/>
|
||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||
</faceted-project>
|
@ -0,0 +1 @@
|
||||
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
|
@ -0,0 +1 @@
|
||||
Window
|
@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.wst.ws.service.policy.projectEnabled=false
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,19 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>air_ticket_book</groupId>
|
||||
<artifactId>air_ticket_book</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1,93 @@
|
||||
package javabean;
|
||||
/********************
|
||||
*@IDE eclipse
|
||||
*@jdk 1.8.0_161
|
||||
*********************/
|
||||
import java.sql.*;
|
||||
|
||||
public class db_conn {
|
||||
public Connection conn = null;
|
||||
public ResultSet res = null;
|
||||
public Statement st = null;
|
||||
|
||||
//数据库初始化连接
|
||||
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 USER="root"; //数据库用户名
|
||||
String PWD="123456"; //数据库密码
|
||||
try{
|
||||
Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
}catch(ClassNotFoundException e){
|
||||
System.out.println("加载驱动失败");
|
||||
System.out.println(e);
|
||||
}
|
||||
try{
|
||||
|
||||
conn = DriverManager.getConnection(URL,USER,PWD);
|
||||
// System.out.println("success");
|
||||
st=conn.createStatement();
|
||||
}catch(SQLException e){
|
||||
System.out.println("连接数据库失败");
|
||||
System.out.println(e);
|
||||
}
|
||||
}
|
||||
|
||||
//向数据库中添加数据
|
||||
public int executeInsert(String sql){
|
||||
int num=0;
|
||||
try{
|
||||
num=st.executeUpdate(sql);
|
||||
}
|
||||
catch(SQLException e){
|
||||
System.out.println("添加数据出错信息:"+e.getMessage());
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
//从数据库中查询数据
|
||||
public ResultSet executeQuery(String sql){
|
||||
res=null;
|
||||
try{
|
||||
res=st.executeQuery(sql);
|
||||
}
|
||||
catch(SQLException e){
|
||||
System.out.print("查询出错信息:"+e.getMessage());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//更新数据
|
||||
public int Update(String sql){
|
||||
int num=0;
|
||||
try{
|
||||
num=st.executeUpdate(sql);
|
||||
}catch(SQLException ex){
|
||||
System.out.print("执行修改有错误:"+ex.getMessage());
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
//删除数据
|
||||
public int executeDelete(String sql){
|
||||
int num=0;
|
||||
try{
|
||||
num=st.executeUpdate(sql);
|
||||
}
|
||||
catch(SQLException e){
|
||||
System.out.print("执行删除有错误:"+e.getMessage());
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
//关闭数据库连接
|
||||
public void closeDB(){
|
||||
try{
|
||||
st.close();
|
||||
conn.close();
|
||||
}
|
||||
catch(Exception e){
|
||||
System.out.print("执行关闭Connection对象有错误:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package javabean;
|
||||
public class flight { //航班类
|
||||
private String f_n=null;//航班号
|
||||
private String f_s_p=null;//起飞地点
|
||||
private String f_a_p=null;//飞行终点
|
||||
private String f_s_a=null;//起飞机场
|
||||
private String f_a_a=null;//到达机场
|
||||
private String f_s_t=null;//起飞时间
|
||||
private String f_a_t=null;//到达时间
|
||||
private String f_p=null;//票价
|
||||
|
||||
|
||||
public String getF_n() {
|
||||
return f_n;
|
||||
}
|
||||
public void setF_n(String f_n) {
|
||||
this.f_n = f_n;
|
||||
}
|
||||
public String getF_s_p() {
|
||||
return f_s_p;
|
||||
}
|
||||
public void setF_s_p(String f_s_p) {
|
||||
this.f_s_p = f_s_p;
|
||||
}
|
||||
public String getF_a_p() {
|
||||
return f_a_p;
|
||||
}
|
||||
public void setF_a_p(String f_a_p) {
|
||||
this.f_a_p = f_a_p;
|
||||
}
|
||||
public String getF_s_a() {
|
||||
return f_s_a;
|
||||
}
|
||||
public void setF_s_a(String f_s_a) {
|
||||
this.f_s_a = f_s_a;
|
||||
}
|
||||
public String getF_a_a() {
|
||||
return f_a_a;
|
||||
}
|
||||
public void setF_a_a(String f_a_a) {
|
||||
this.f_a_a = f_a_a;
|
||||
}
|
||||
public String getF_s_t() {
|
||||
return f_s_t;
|
||||
}
|
||||
public void setF_s_t(String f_s_t) {
|
||||
this.f_s_t = f_s_t;
|
||||
}
|
||||
public String getF_a_t() {
|
||||
return f_a_t;
|
||||
}
|
||||
public void setF_a_t(String f_a_t) {
|
||||
this.f_a_t = f_a_t;
|
||||
}
|
||||
public String getF_p() {
|
||||
return f_p;
|
||||
}
|
||||
public void setF_p(String f_p) {
|
||||
this.f_p = f_p;
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package javabean;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import javabean.db_conn;
|
||||
|
||||
//用户头像功能
|
||||
public class get_img {
|
||||
|
||||
|
||||
public String img;
|
||||
public String user_id;
|
||||
|
||||
public String getUser_id() {
|
||||
return user_id;
|
||||
}
|
||||
|
||||
public void setUser_id(String user_id) {
|
||||
this.user_id = user_id;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
//System.out.println("函数被调用了");
|
||||
|
||||
db_conn conn=new db_conn();
|
||||
String sql="select avatar_img from common_user where "
|
||||
+ "user_name='"+getUser_id()+"'";
|
||||
ResultSet res=conn.executeQuery(sql);
|
||||
try {
|
||||
if(res.next()) {
|
||||
img=res.getString(1);
|
||||
if(img==null) {
|
||||
img="/air_ticket_book/index/images/photo.png";
|
||||
}else {
|
||||
img="/air_ticket_book/index/upload/"+img;
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
System.out.println("出错信息如下:"+e);
|
||||
|
||||
}
|
||||
return img;
|
||||
}
|
||||
|
||||
public void setImg(String img) {
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package javabean;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
public class oDate {
|
||||
public String get_date() {
|
||||
String date=null;
|
||||
Calendar cal=Calendar.getInstance();
|
||||
int y=cal.get(Calendar.YEAR);
|
||||
int m=cal.get(Calendar.MONTH)+1;
|
||||
int d=cal.get(Calendar.DATE);
|
||||
date=y+"-"+m+"-"+d;
|
||||
return date;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package javabean;
|
||||
public class passenger { //顾客类
|
||||
private String p_id=null;//身份证号
|
||||
private String p_name=null;//姓名
|
||||
private String p_tel=null;//电话
|
||||
private String p_sex=null;//性别
|
||||
private String p_work=null;//工作单位
|
||||
private String p_pwd=null;//密码
|
||||
|
||||
|
||||
public String get_p_id() {
|
||||
return p_id;
|
||||
}
|
||||
public void set_p_id(String p_id) {
|
||||
this.p_id = p_id;
|
||||
}
|
||||
public String get_p_name() {
|
||||
return p_name;
|
||||
}
|
||||
public void set_p_name(String p_name) {
|
||||
this.p_name = p_name;
|
||||
}
|
||||
public String get_p_tel() {
|
||||
return p_tel;
|
||||
}
|
||||
public void set_p_tel(String p_tel) {
|
||||
this.p_tel = p_tel;
|
||||
}
|
||||
public String get_p_sex() {
|
||||
return p_sex;
|
||||
}
|
||||
public void set_p_sex(String p_sex) {
|
||||
this.p_sex = p_sex;
|
||||
}
|
||||
public String get_p_work() {
|
||||
return p_work;
|
||||
}
|
||||
public void set_p_work(String p_work) {
|
||||
this.p_work = p_work;
|
||||
}
|
||||
public String get_p_pwd() {
|
||||
return p_pwd;
|
||||
}
|
||||
public void set_p_pwd(String p_pwd) {
|
||||
this.p_pwd = p_pwd;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,62 @@
|
||||
package servlet;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import javabean.db_conn;
|
||||
|
||||
public class check extends HttpServlet {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public void doGet(HttpServletRequest req, HttpServletResponse resp)
|
||||
throws ServletException, IOException {
|
||||
resp.setContentType("text/html;charset=utf-8");
|
||||
PrintWriter out = resp.getWriter();
|
||||
out.println("请使用默认方式提交数据,不要尝试非法操作");
|
||||
}
|
||||
|
||||
public void doPost(HttpServletRequest req, HttpServletResponse resp)
|
||||
throws ServletException, IOException {
|
||||
resp.setContentType("text/html;charset=utf-8");
|
||||
String id = null;
|
||||
String password = null;
|
||||
HttpSession session = req.getSession();
|
||||
id = req.getParameter("id");
|
||||
password = req.getParameter("password");
|
||||
|
||||
db_conn conn = new db_conn();
|
||||
|
||||
String sql = "select * from admin_user where user = '"+id+"'";
|
||||
|
||||
|
||||
try {
|
||||
ResultSet res = conn.executeQuery(sql);
|
||||
if(res.next()) {
|
||||
String pwd = res.getString(2);
|
||||
//System.out.println(pwd+"hha");
|
||||
if(password.equals(pwd)) {
|
||||
session.setAttribute("admin_id", id);
|
||||
resp.sendRedirect("frame");
|
||||
}else {
|
||||
System.out.println("密码错误"+res);
|
||||
resp.sendRedirect("/air_ticket_book/admin/index.jsp");
|
||||
}
|
||||
}else {
|
||||
System.out.println("账号错误");
|
||||
resp.sendRedirect("/air_ticket_book/admin/index.jsp");
|
||||
}
|
||||
}catch(SQLException e) {
|
||||
System.out.println("出现不可预见性错误,错误信息如下:"+e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import javabean.db_conn;
|
||||
import javabean.oDate;
|
||||
|
||||
public class deal_message extends HttpServlet {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
resp.sendRedirect("default/message_board.jsp");
|
||||
//用户非法的操作,直接忽略即可
|
||||
}
|
||||
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
//System.out.println("dopost被调用了");
|
||||
req.setCharacterEncoding("utf-8");
|
||||
oDate o_date=new oDate();
|
||||
String user_name=null;
|
||||
String user_message=null;
|
||||
user_name=req.getParameter("name").toString();
|
||||
user_message=req.getParameter("message").toString();
|
||||
String getDate=o_date.get_date();
|
||||
if(!user_name.equals("")&&!user_message.equals("")) {
|
||||
//System.out.println("条件语句判断成功了");
|
||||
db_conn conn = new db_conn();
|
||||
String sql="insert into user_message (time,user_name,message_content) values('"+getDate+"','"+user_name+"','"+user_message+"')";
|
||||
//System.out.println(sql);
|
||||
int res=conn.executeInsert(sql);
|
||||
System.out.println(res);
|
||||
|
||||
//resp.sendRedirect("default/message_board.jsp");
|
||||
conn.closeDB();
|
||||
}
|
||||
resp.sendRedirect("default/message_board.jsp");
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
||||
import javabean.db_conn;
|
||||
@WebServlet("/del_ptp")
|
||||
|
||||
public class del_ptp extends HttpServlet {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
String p_id2=req.getParameter("p_id2");
|
||||
db_conn conn=new db_conn();
|
||||
String sql="delete from ptp where p_id2='"+p_id2+"'";
|
||||
conn.executeDelete(sql);
|
||||
resp.setHeader("refresh", "2;url=/air_ticket_book/index/ptp_change_success.jsp");
|
||||
}
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
resp.setHeader("refresh", "2;url=/air_ticket_book/index/ptp_change_success.jsp");
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import javabean.db_conn;
|
||||
|
||||
public class del_user_message extends HttpServlet {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
String sort=req.getParameter("class");
|
||||
if(sort.equals("user")) {
|
||||
String user_name=req.getParameter("id");
|
||||
db_conn conn=new db_conn();
|
||||
String sql="delete from p_inf where p_tel='"+user_name+"'";
|
||||
conn.executeDelete(sql);
|
||||
resp.sendRedirect("admin/user_list.jsp");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
public class frame extends HttpServlet {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public void doGet(HttpServletRequest req, HttpServletResponse resp)
|
||||
throws ServletException, IOException {
|
||||
HttpSession session = req.getSession();
|
||||
if(session.getAttribute("admin_id") != null) {
|
||||
RequestDispatcher rd=getServletContext().getRequestDispatcher("/admin/frame.jsp");
|
||||
rd.forward(req, resp);
|
||||
}else {
|
||||
resp.sendRedirect("/air_ticket_book/admin/index.jsp");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package servlet;
|
||||
import java.io.IOException;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
|
||||
import javabean.db_conn;
|
||||
import javabean.flight;
|
||||
|
||||
public class search_fly extends HttpServlet {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
HttpSession session = req.getSession();
|
||||
String url=null;
|
||||
if(session.getAttribute("url")!=null) {
|
||||
url=session.getAttribute("url").toString();
|
||||
}else {
|
||||
url="default/index.jsp";
|
||||
}
|
||||
resp.sendRedirect(url);
|
||||
}
|
||||
|
||||
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
req.setCharacterEncoding("utf-8");
|
||||
String url=null;
|
||||
url="default/index.jsp";
|
||||
|
||||
String departure=null;
|
||||
String destination=null;
|
||||
departure=req.getParameter("departure");
|
||||
destination=req.getParameter("destination");
|
||||
String sql=null;
|
||||
|
||||
|
||||
if(departure==""&&destination=="") {
|
||||
//如果始发地和目的地都为空则跳转回原页面
|
||||
resp.sendRedirect(url);
|
||||
}else if (departure!=""&&destination=="") {
|
||||
sql="select * from flight where f_s_p='"+departure+"'";
|
||||
}else if (departure==""&&destination!="") {
|
||||
sql="select * from flight where f_a_p='"+destination+"'";
|
||||
}else if (departure!=""&&destination!="") {
|
||||
sql="select * from flight where f_s_p='"+departure+"' and f_a_p='"+destination+"'";
|
||||
}
|
||||
if(departure==""&&destination=="") {
|
||||
}else {
|
||||
db_conn conn=new db_conn();
|
||||
ArrayList<flight> flightlist = new ArrayList<flight>();
|
||||
|
||||
ResultSet res=conn.executeQuery(sql);
|
||||
try {
|
||||
while (res.next()) {
|
||||
flight flight_info=new flight();
|
||||
flight_info.setF_n(res.getString(1));
|
||||
flight_info.setF_s_p(res.getString(2));
|
||||
flight_info.setF_a_p(res.getString(3));
|
||||
flight_info.setF_s_a(res.getString(4));
|
||||
flight_info.setF_a_a(res.getString(5));
|
||||
flight_info.setF_s_t(res.getString(6));
|
||||
flight_info.setF_a_t(res.getString(7));
|
||||
flight_info.setF_p(res.getString(8));
|
||||
flightlist.add(flight_info);
|
||||
|
||||
}
|
||||
req.setAttribute("flightlist", flightlist);
|
||||
} catch (SQLException e) {
|
||||
System.out.println("错误信息:"+e);
|
||||
}finally {
|
||||
conn.closeDB();
|
||||
}
|
||||
req.getRequestDispatcher("default/search.jsp").forward(req, resp);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
public class userCenter extends HttpServlet{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
HttpSession session = req.getSession();
|
||||
Object user_id = session.getAttribute("user_id");
|
||||
if(user_id != null) {
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher("/index/user_center.jsp");
|
||||
rd.forward(req, resp);
|
||||
session.setAttribute("url", "/air_ticket_book/user_center");
|
||||
}else {
|
||||
resp.sendRedirect("index/login_reg.jsp");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
Manifest-Version: 1.0
|
||||
Build-Jdk-Spec: 21
|
||||
Created-By: Maven Integration for Eclipse
|
||||
|
@ -0,0 +1,7 @@
|
||||
#Generated by Maven Integration for Eclipse
|
||||
#Fri Oct 04 17:12:19 CST 2024
|
||||
artifactId=air_ticket_book
|
||||
groupId=air_ticket_book
|
||||
m2e.projectLocation=D\:\\college\\SE2\\air_ticket_book-master\\\u8F6F\u4EF6\u5DE5\u7A0B\u8BFE\u7A0B\u8BBE\u8BA1\\air_ticket_book
|
||||
m2e.projectName=air_ticket_book
|
||||
version=0.0.1-SNAPSHOT
|
@ -0,0 +1,19 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>air_ticket_book</groupId>
|
||||
<artifactId>air_ticket_book</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue