package servlet;
import java.io.IOException;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import model.TXiezi;
import db.DB;
public class xiezi_servlet extends HttpServlet{
public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException
{
String type=req.getParameter("type");
if(type.endsWith("xieziMana"))
{
xieziMana(req, res);
}
if(type.endsWith("xieziAll"))
{
xieziAll(req, res);
}
if(type.endsWith("kucun"))
{
kucun(req, res);
}
if(type.endsWith("xieziAdd"))
{
xieziAdd(req, res);
}
if(type.endsWith("xieziUpd"))
{
xieziUpd(req, res);
}
if(type.endsWith("xieziDele"))
{
xieziDele(req, res);
}
}
public void xieziAdd(HttpServletRequest req,HttpServletResponse res){
String bianhao = req.getParameter("bianhao");
String mingcheng = req.getParameter("mingcheng");
String pinpai= req.getParameter("pinpai");
String chima = req.getParameter("chima");
String yanse = req.getParameter("yanse");
String danjia = req.getParameter("danjia");
int shuliang = 0;
String del = "no";
String sql = "insert into t_xiezi values (?,?,?,?,?,?,?,?)";
Object[] params={bianhao,mingcheng,pinpai,chima,yanse,danjia,shuliang,del};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();
req.setAttribute("message", "操作成功");
req.setAttribute("path", "xiezi?type=xieziMana");
String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}
public void xieziUpd(HttpServletRequest req,HttpServletResponse res){
String id = req.getParameter("id");
String bianhao = req.getParameter("bianhao");
String mingcheng = req.getParameter("mingcheng");
String pinpai= req.getParameter("pinpai");
String chima = req.getParameter("chima");
String yanse = req.getParameter("yanse");
String danjia = req.getParameter("danjia");
String sql = "update t_xiezi set bianhao=?,mingcheng=?,pinpai=?,chima=?,yanse=?," +
"danjia=? where id=?";
Object[] params={bianhao,mingcheng,pinpai,chima,yanse,danjia,id};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();
req.setAttribute("message", "操作成功");
req.setAttribute("path", "xiezi?type=xieziMana");
String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}
public void xieziDele(HttpServletRequest req,HttpServletResponse res){
String id = req.getParameter("id");
String del = "yes";
String sql = "update t_xiezi set del=? where id=?";
Object[] params={del,id};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();
req.setAttribute("message", "操作成功");
req.setAttribute("path", "xiezi?type=xieziMana");
String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}
public void xieziMana(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
List xieziList = new ArrayList();
String sql = "select * from t_xiezi where del = 'no'";
Object[] params={};
DB mydb=new DB();
try
{
mydb.doPstm(sql, params);
ResultSet rs=mydb.getRs();
while(rs.next())
{
TXiezi xiezi = new TXiezi();
xiezi.setId(rs.getInt("id"));
xiezi.setBianhao(rs.getString("bianhao"));
xiezi.setMingcheng(rs.getString("mingcheng"));
xiezi.setPinpai(rs.getString("pinpai"));
xiezi.setChima(rs.getString("chima"));
xiezi.setYanse(rs.getString("yanse"));
xiezi.setDanjia(rs.getString("danjia"));
xiezi.setShuliang(rs.getInt("shuliang"));
xieziList.add(xiezi);
}
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
mydb.closed();
req.setAttribute("xieziList", xieziList);
req.getRequestDispatcher("admin/xiezi/xieziMana.jsp").forward(req, res);
}
public void xieziAll(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
List xieziList = new ArrayList();
String sql = "select * from t_xiezi where del = 'no'";
Object[] params={};
DB mydb=new DB();
try
{
mydb.doPstm(sql, params);
ResultSet rs=mydb.getRs();
while(rs.next())
{
TXiezi xiezi = new TXiezi();
xiezi.setId(rs.getInt("id"));
xiezi.setBianhao(rs.getString("bianhao"));
xiezi.setMingcheng(rs.getString("mingcheng"));
xiezi.setPinpai(rs.getString("pinpai"));
xiezi.setChima(rs.getString("chima"));
xiezi.setYanse(rs.getString("yanse"));
xiezi.setDanjia(rs.getString("danjia"));
xiezi.setShuliang(rs.getInt("shuliang"));
xieziList.add(xiezi);
}
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
mydb.closed();
req.setAttribute("xieziList", xieziList);
req.getRequestDispatcher("admin/xiezi/xieziSele.jsp").forward(req, res);
}
public void kucun(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
List xieziList = new ArrayList();
String sql = "select ta.*,tb.gonghuoshang from t_xiezi ta,t_jinhuo tb where ta.id=tb.xiezi_id and del = 'no'";
Object[] params={};
DB mydb=new DB();
try
{
mydb.doPstm(sql, params);
ResultSet rs=mydb.getRs();
while(rs.next())
{
TXiezi xiezi = new TXiezi();
xiezi.setId(rs.getInt("id"));
xiezi.setBianhao(rs.getString("bianhao"));
xiezi.setMingcheng(rs.getString("mingcheng"));
xiezi.setPinpai(rs.getString("pinpai"));
xiezi.setChima(rs.getString("chima"));
xiezi.setYanse(rs.getString("yanse"));
xiezi.setDanjia(rs.getString("danjia"));
xiezi.setShuliang(rs.getInt("shuliang"));
xiezi.setGonghuoshang(rs.getString("gonghuoshang"));
xieziList.add(xiezi);
}
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
mydb.closed();
req.setAttribute("xieziList", xieziList);
req.getRequestDispatcher("admin/xiezi/kucun.jsp").forward(req, res);
}
public void dispatch(String targetURI,HttpServletRequest request,HttpServletResponse response)
{
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);
try
{
dispatch.forward(request, response);
return;
}
catch (ServletException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
本系统前台主要使用JSP作为开发语言,后台使用SqlServer作为数据库管理系统,开发环境是MyEclipse,服务器采用tomcat,开发出的一个基于Web技术的B/S结构的鞋店管理系统。 内含项目完整代码,数据库及配套报告。
资源推荐
资源详情
资源评论
收起资源包目录
毕业设计:基于jsp的鞋店管理系统 (222个子文件)
xiezi_servlet.class 6KB
xiaoshou_servlet.class 4KB
jinhuo_servlet.class 4KB
tuihuo_servlet.class 4KB
gongzi_servlet.class 4KB
lirun_servlet.class 4KB
DB.class 4KB
loginService.class 4KB
TXiezi.class 2KB
TGongzi.class 2KB
TLirun.class 2KB
TJinhuo.class 2KB
TXiaoshou.class 2KB
TTuihuo.class 2KB
EncodingFilter.class 2KB
DateUtils.class 1KB
TAdmin.class 910B
.classpath 2KB
css.css 10KB
base.css 5KB
woncore.css 3KB
dtree.css 795B
论文.doc 1.44MB
luxiang.exe 2MB
reservation01.gif 22KB
login-content-bg.gif 20KB
login-wel.gif 9KB
login_06.gif 4KB
main_01.gif 3KB
main_21.gif 3KB
main_06.gif 3KB
main_37.gif 2KB
loading.gif 2KB
main_17.gif 2KB
main_066.gif 2KB
main_05.gif 2KB
left_2.gif 1KB
left_4.gif 1KB
left_3.gif 1KB
left_1.gif 1KB
top_12.gif 1KB
globe.gif 1KB
top_14.gif 1KB
top_15.gif 1KB
top_9.gif 1KB
top_13.gif 1KB
login_09.gif 1KB
trash.gif 1KB
question.gif 1KB
top_10.gif 1KB
base.gif 1KB
top_17.gif 1KB
top_11.gif 1KB
top_8.gif 1KB
top_18.gif 995B
nolines_plus.gif 870B
nolines_minus.gif 861B
main_07.gif 821B
main_09.gif 734B
musicfolder.gif 633B
imgfolder.gif 622B
head1.gif 610B
page.gif 582B
main_13.gif 580B
top_16.gif 574B
top_7.gif 561B
main_25.gif 559B
xyb.gif 556B
syb.gif 554B
top_5.gif 523B
main_36.gif 498B
main_43.gif 493B
right_03.gif 486B
main_15.gif 441B
luck.gif 429B
main_03.gif 427B
main_38.gif 426B
folderopen.gif 376B
tab_bg.gif 376B
folder.gif 372B
qx.gif 359B
main_30.gif 354B
main_30_1.gif 354B
dl.gif 341B
main_40.gif 339B
main_11.gif 334B
top_4.gif 316B
top_3.gif 316B
wbg.gif 311B
login_03.gif 305B
right_10.gif 294B
main_18.gif 285B
cd.gif 239B
top_6.gif 214B
top_2.gif 211B
right_06.gif 211B
right_12.gif 200B
right_061.gif 195B
login-top-bg.gif 174B
Submit_bg.gif 171B
共 222 条
- 1
- 2
- 3
资源评论
- 他最爱病娇了2022-06-04用户下载后在一定时间内未进行评价,系统默认好评。
胥华引
- 粉丝: 89
- 资源: 439
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功