package dp.admin.svlt;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
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 dp.been.Cusinfo;
import dp.been.Dpiao;
import dp.been.Piao;
import dp.been.Traininfo;
import dp.been.Userinfo;
import dp.been.Xianlu;
import dp.been.Zhandian;
import dp.utils.DbConn;
import dp.utils.FindService;
import dp.utils.HandleProperties;
public class Init extends HttpServlet {
/**
* Constructor of the object.
*/
public Init() {
super();
}
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doPost(request, response);
}
/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//设置传输数据编码方式
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("text/html");
HttpSession session=request.getSession();
//获取当前登录用户信息
Object utype=session.getAttribute("utype");
Object userid=session.getAttribute("userid");
if(utype==null||userid==null){
return;
}
//获取前台数据
String flgs=request.getParameter("flgs");
String tname=request.getParameter("tname");
//定义sql语句变量
String sql="";
//创建配置文件操作对象
HandleProperties hp=new HandleProperties(session,utype+""+userid);
//创建数据库操作对象
DbConn db=new DbConn();
//管理员信息管理初始化
if("admin".equals(tname)){
if("1".equals(flgs)){
sql="select * from userinfo";
hp.setValue("sql", sql);
}else{
sql=hp.readValue("sql");
}
ResultSet rs=db.query(sql);
List<Userinfo> alist=FindService.getUserinfo(rs);
request.setAttribute("alist", alist);
request.getRequestDispatcher("/admin/mgadmin.jsp").forward(request, response);
return;
}
//顾客信息管理初始化
if("cusinfo".equals(tname)){
if("1".equals(flgs)){
sql="select * from cusinfo";
hp.setValue("sql", sql);
}else{
sql=hp.readValue("sql");
}
ResultSet rs=db.query(sql);
List<Cusinfo> alist=FindService.getCusinfo(rs);
request.setAttribute("alist", alist);
request.getRequestDispatcher("/admin/mgcusinfo.jsp").forward(request, response);
return;
}
//火车信息管理初始化
if("traininfo".equals(tname)){
if("1".equals(flgs)){
sql="select * from traininfo";
hp.setValue("sql", sql);
}else{
sql=hp.readValue("sql");
}
ResultSet rs=db.query(sql);
List<Traininfo> alist=FindService.getTraininfo(rs);
request.setAttribute("alist", alist);
request.getRequestDispatcher("/admin/mgtraininfo.jsp").forward(request, response);
return;
}
//站点信息管理初始化
if("zhandian".equals(tname)){
if("1".equals(flgs)){
sql="select * from zhandian";
hp.setValue("sql", sql);
}else{
sql=hp.readValue("sql");
}
ResultSet rs=db.query(sql);
List<Zhandian> alist=FindService.getZhandian(rs);
request.setAttribute("alist", alist);
request.getRequestDispatcher("/admin/mgzhandian.jsp").forward(request, response);
return;
}
//线路信息初始化
if("initxl".equals(tname)){
if("1".equals(flgs)){
sql="select * from traininfo";
hp.setValue("sql", sql);
}else{
sql=hp.readValue("sql");
}
List<Xianlu> xllist=new ArrayList();
DbConn db2=new DbConn();
ResultSet rs=db.query(sql);
List<Traininfo> tlist=FindService.getTraininfo(rs);
Iterator<Traininfo> it=tlist.iterator();
while(it.hasNext()){
Traininfo t=it.next();
Xianlu xl=new Xianlu();
xl.setTid(t.getId());
xl.setTname(t.getTname());
ResultSet rs2=db2.query("select zhandian.*,xh from xianlu,zhandian where xianlu.zdid=zhandian.id and xianlu.tid="+t.getId()+" order by xh");
List<Zhandian> zdlist=FindService.getZhandian(rs2);
xl.setZdlist(zdlist);
xllist.add(xl);
}
request.setAttribute("alist", xllist);
request.getRequestDispatcher("/admin/initxianlu.jsp").forward(request, response);
return;
}
//线路信息管理初始化
if("xianlu".equals(tname)){
String ids=request.getParameter("tid");
if("1".equals(flgs)){
sql="select zhandian.*,xh from zhandian,xianlu where zhandian.id=xianlu.zdid and xianlu.tid="+ids+" order by xh";
hp.setValue("sql", sql);
}else{
sql=hp.readValue("sql");
}
ResultSet rs=db.query(sql);
List<Zhandian> zlist=FindService.getZhandians(rs);
request.setAttribute("alist", zlist);
DbConn db2=new DbConn();
ResultSet rs2=db2.query("select * from zhandian where id not in(select zdid from xianlu where tid="+ids+")");
List<Zhandian> zdlist=FindService.getZhandian(rs2);
request.setAttribute("zdlist", zdlist);
DbConn db3=new DbConn();
Object tn=db3.getOnlyOne("select tname from traininfo where id="+ids);
Traininfo t=new Traininfo();
t.setId(Integer.parseInt(ids));
t.setTname(tn+"");
request.setAttribute("t", t);
request.getRequestDispatcher("/admin/mgxianlu.jsp").forward(request, response);
return;
}
//车票信息管理初始化
if("piao".equals(tname)){
String ids=request.getParameter("tid");
if("1".equals(flgs)){
sql="select tmp.*,zdname as eaddr,tname,traintype from (select piao.*,zdname as saddr from piao,zhandian where piao.szdid=zhandian.id and yxsj='1975-01-01' and zdname like '%0%') tmp,zhandian,traininfo where tmp.tid=traininfo.id and tmp.ezdid=zhandian.id and zdname like '%0%' and 1=0";
hp.setValue("sql", sql);
}else{
sql=hp.readValue("sql");
}
ResultSet rs2=db.query(sql);
List<Piao> plist=FindService.getPiao(rs2);
request.setAttribute("alist", plist);
DbConn db2=new DbConn();
ResultSet rs=db2.query("select * from traininfo");
List<Traininfo> tlist=FindService.getTraininfo(rs);
request.setAttribute("tlist", tlist);
request.getRequestDispatcher("/admin/mgpiao.jsp").forward(request, response);
return;
}
//订票信息管理初始化
if("dpiao".equals(tname)){
ResultSet rs=db.query("select dpiao.*,cxzh,ezdid,ezdname,ptype,pval,stime,szdid,szdname,tid,tname,traintype,yxsj from(select tmp.*,zdname as ezdname from(select piao.*,zdname as szdname,tname,traintype from piao,zhandian,traininfo where piao.tid=traininfo.id and piao.szdid=zhandian.id)tmp,zhandian where tmp.ezdid=zhandian.id)tm,dpiao,cusinfo where tm.id=dpiao.pid and dpiao.cidcard=cusinfo.cidcard");
List<Dpiao> dplist=FindService.getDpiao(rs);
request.setAttribute("alist", dplist);
request.getRequestDispatcher("/admin/mdpiao.jsp").forward(request, response);
return;
}
没有合适的资源?快使用搜索试试~ 我知道了~
html css js网页设计,火车票订票系统
共405个文件
png:95个
gif:87个
css:47个
0 下载量 46 浏览量
2023-12-13
14:05:39
上传
评论
收藏 7.46MB ZIP 举报
温馨提示
html css js网页设计 火车票订票系统。 功能:车票信息查询,登录,注册。后台管理:火车,站点查询,车票信息管理。 技术:servlet,jsp。
资源推荐
资源详情
资源评论
收起资源包目录
html css js网页设计,火车票订票系统 (405个子文件)
Init.class 8KB
UpdSvlt.class 6KB
Add.class 6KB
FindService.class 5KB
Del.class 4KB
LoginSvlt.class 3KB
ChangePwd.class 3KB
HandlePiaoSvlt.class 3KB
HandleProperties.class 3KB
DbConn.class 3KB
DpSvlt.class 3KB
Dpiao.class 3KB
DpListSvlt.class 3KB
RegSvlt.class 3KB
Piao.class 3KB
CkSvlt.class 3KB
GetZdByTid.class 3KB
CusCkSvlt.class 3KB
LogoutSvlt.class 2KB
Xianlu.class 1KB
Traininfo.class 1KB
InitLoginSvlt.class 1KB
Cusinfo.class 1KB
Userinfo.class 1KB
Zhandian.class 890B
.classpath 1018B
org.eclipse.wst.common.component 464B
org.eclipse.wst.jsdt.ui.superType.container 49B
jquery-ui-1.7.3.custom.css 22KB
jquery.ui.theme.css 17KB
jquery.ui.theme.css 17KB
style.css 7KB
calendar.css 6KB
jquery.ui.datepicker.css 4KB
jquery.ui.datepicker.css 4KB
Editor.css 3KB
Editor.css 3KB
Editor.css 3KB
Editor.css 3KB
Editor.css 3KB
Editor.css 3KB
Editor.css 3KB
Editor.css 3KB
Editor.css 3KB
topa.css 2KB
Append_1_d.css 1KB
Edit_1_d.css 1KB
Find_1_d.css 1KB
jquery.ui.core.css 1KB
jquery.ui.core.css 1KB
Brows.css 1KB
dtree.css 1KB
Append.css 1KB
Edit.css 1KB
Find.css 1KB
reg.css 595B
MenuArea.css 545B
MenuArea.css 545B
MenuArea.css 545B
MenuArea.css 545B
MenuArea.css 545B
MenuArea.css 545B
MenuArea.css 545B
MenuArea.css 545B
MenuArea.css 545B
EditorArea.css 165B
EditorArea.css 165B
EditorArea.css 165B
EditorArea.css 165B
EditorArea.css 165B
EditorArea.css 165B
EditorArea.css 165B
EditorArea.css 165B
EditorArea.css 165B
mytable.css 152B
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
Entries 1KB
Entries 342B
Entries 301B
Entries 138B
Entries 138B
Entries 138B
Entries 138B
Entries 138B
Entries 138B
Entries 138B
Entries 138B
Entries 96B
top_left.gif 31KB
top_right.gif 14KB
top_right_a.gif 8KB
复件 menu_foot.gif 4KB
menu_bgT.gif 4KB
menu_top.gif 3KB
main_headerL.gif 2KB
top_right_b1.gif 2KB
共 405 条
- 1
- 2
- 3
- 4
- 5
资源评论
瞬间的醒悟
- 粉丝: 448
- 资源: 104
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功