基于javaweb+mysql的jsp+servlet在线药店管理系统(java+jsp+bootstrap+jquery+mysql)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的JSP+Servlet在线药店管理系统(java+jsp+bootstrap+jquery+mysql)
含PPT
项目介绍
基于jsp+servlet在线药店管理系统。 该项目是一个后管系统,只有一个管理员角色,功能比较简单,适合java初学者或者学生做课程设计等;
主要功能包括:
用户登录、注册;系统管理、药品管理、顾客信息管理、供货商管理、订单管理等;
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目 6.数据库:MySql 5.7版本;
技术栈
- 后端:servlet 2. 前端:JSP+bootstrap+jQuery
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行; 3. 将项目中c3p0.properties配置文件中的数据库配置改为自己的配置 4. 运行项目,输入http://localhost:8080/shop 登录 5. 账户admin 密码123456
if(z)
{
showOrderByPage(request,response);
}
}
public void showOrder(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showOrder.....");
List<Order> order=orderService.showOrder();
request.setAttribute("order", order);
request.getRequestDispatcher("order/index.jsp").forward(request, response);
}
public void showOrderByPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showOrderByPage.....");
String current_page=request.getParameter("current_page");
//先有鸡还是先有蛋。
int count_rows=orderService.counts();
PageTools pt=new PageTools(current_page, count_rows);
List<Order> order=orderService.showOrderByPage(pt);
//System.out.println(order);
request.setAttribute("pt", pt);
request.setAttribute("order",order);
request.getRequestDispatcher("order/index.jsp").forward(request, response);
}
public void showOrderByOid(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showOrderByDid....");
int oid=Integer.parseInt(request.getParameter("oid"));
Order order=orderService.showOrderByOid(oid);
if(order!=null)
{
request.setAttribute("order",order);
request.getRequestDispatcher("order/index.jsp").forward(request, response);
}
}
public void updateOrder(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is updateOrder...");
try {
int oid=Integer.parseInt(request.getParameter("oid"));
String did=request.getParameter("did");
int oquantity=Integer.parseInt(request.getParameter("oquantity"));
}
}
public void showCustomer(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showCustomer.....");
List<Customer> customer=customerService.showCustomer();
request.setAttribute("customer", customer);
request.getRequestDispatcher("customer/index.jsp").forward(request, response);
}
public void showCustomerByPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showCustomerByPage.....");
String current_page=request.getParameter("current_page");
//先有鸡还是先有蛋。
int count_rows=customerService.counts();
PageTools pt=new PageTools(current_page, count_rows);
List<Customer> customer=customerService.showCustomerByPage(pt);
request.setAttribute("pt", pt);
request.setAttribute("customer",customer);
request.getRequestDispatcher("customer/index.jsp").forward(request, response);
}
public void showCustomerByCid(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showCustomerByCid....");
int cid=Integer.parseInt(request.getParameter("cid"));
Customer customer=customerService.showCustomerByCid(cid);
if(customer!=null)
{
request.setAttribute("customer",customer);
request.getRequestDispatcher("customer/edit.jsp").forward(request, response);
}
}
public void updateCustomer(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is updateCustomer...");
try {
int cid=Integer.parseInt(request.getParameter("cid"));
String cname=request.getParameter("cname");
String csex=request.getParameter("csex");
int cage=Integer.parseInt(request.getParameter("cage"));
String cphone= request.getParameter("cphone");
String cemail= request.getParameter("cemail");
String caddress= request.getParameter("caddress");
public void deleteSupplierBySname(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is deleteSupplierBySname....");
String sname=request.getParameter("sname");
boolean z= supplierService.deleteSupplierBySname(sname);
System.out.println("z:"+z);
if(z)
{
showSupplierByPage(request,response);
}
}
public void showSupplier(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showSupplier.....");
List<Supplier> supplier=supplierService.showSupplier();
request.setAttribute("supplier", supplier);
request.getRequestDispatcher("supplier/index.jsp").forward(request, response);
}
public void showSupplierByPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showSupplierByPage.....");
String current_page=request.getParameter("current_page");
//先有鸡还是先有蛋。
int count_rows=supplierService.counts();
PageTools pt=new PageTools(current_page, count_rows);
List<Supplier> supplier=supplierService.showSupplierByPage(pt);
request.setAttribute("pt", pt);
request.setAttribute("supplier",supplier);
request.getRequestDispatcher("supplier/index.jsp").forward(request, response);
}
public void showSupplierBySname(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showSupplierBySname....");
String sname=request.getParameter("sname");
Supplier supplier=supplierService.showSupplierBySname(sname);
if(supplier!=null)
{
request.setAttribute("supplier",supplier);
request.getRequestDispatcher("supplier/edit.jsp").forward(request, response);
}
}
public void updateSupplier(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is updateSupplier...");
try {
String sname=request.getParameter("sname");
String sphone=request.getParameter("sphone");
String saddress= request.getParameter("saddress");
Supplier supplier=new Supplier();
supplier.setSname(sname);
supplier.setSphone(sphone);
supplier.setSaddress(saddress);
public void updateCustomer(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is updateCustomer...");
try {
int cid=Integer.parseInt(request.getParameter("cid"));
String cname=request.getParameter("cname");
String csex=request.getParameter("csex");
int cage=Integer.parseInt(request.getParameter("cage"));
String cphone= request.getParameter("cphone");
String cemail= request.getParameter("cemail");
String caddress= request.getParameter("caddress");
Customer customer=new Customer();
customer.setCid(cid);
customer.setCname(cname);
customer.setCsex(csex);
customer.setCage(cage);
customer.setCphone(cphone);
customer.setCemail(cemail);
customer.setCaddress(caddress);
//System.out.println(customer);//检查。
boolean z=customerService.updateCustomer(customer);
if(z)
{
showCustomerByPage(request,response);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void updateCustomerByCid(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is updateCustomerByCid....");
int cid=Integer.parseInt(request.getParameter("cid"));
//System.out.println(did);
Customer customer=customerService.showCustomerByCid(cid);
if(customer!=null)
{
request.setAttribute("customer", customer);
request.getRequestDispatcher("customer/edit.jsp").forward(request, response);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void updateCustomerByCid(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is updateCustomerByCid....");
int cid=Integer.parseInt(request.getParameter("cid"));
//System.out.println(did);
Customer customer=customerService.showCustomerByCid(cid);
if(customer!=null)
{
request.setAttribute("customer", customer);
request.getRequestDispatcher("customer/edit.jsp").forward(request, response);
}
}
}
/**
* Servlet implementation class OrderServlet
*/
@WebServlet("/orderServlet.do")
public class OrderServlet extends BaseServlet{
private static final long serialVersionUID = 1L;
private OrderService orderService=new OrderService();
public void insertOrder(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is insertOrder....");
try {
//int oid=Integer.parseInt(request.getParameter("oid"));
String did=request.getParameter("did");
e.printStackTrace();
}
}
public void deleteCustomerByCid(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is deleteCustomerByCid....");
int cid=Integer.parseInt(request.getParameter("cid"));
boolean z= customerService.deleteCustomerByCid(cid);
System.out.println("z:"+z);
if(z)
{
showCustomerByPage(request,response);
}
}
public void showCustomer(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showCustomer.....");
List<Customer> customer=customerService.showCustomer();
request.setAttribute("customer", customer);
request.getRequestDispatcher("customer/index.jsp").forward(request, response);
}
public void showCustomerByPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showCustomerByPage.....");
String current_page=request.getParameter("current_page");
//先有鸡还是先有蛋。
int count_rows=customerService.counts();
PageTools pt=new PageTools(current_page, count_rows);
List<Customer> customer=customerService.showCustomerByPage(pt);
request.setAttribute("pt", pt);
request.setAttribute("customer",customer);
request.getRequestDispatcher("customer/index.jsp").forward(request, response);
}
public void showCustomerByCid(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showCustomerByCid....");
int cid=Integer.parseInt(request.getParameter("cid"));
Customer customer=customerService.showCustomerByCid(cid);
if(customer!=null)
{
request.setAttribute("customer",customer);
request.getRequestDispatcher("customer/edit.jsp").forward(request, response);
Order order=new Order();
//order.setOid(oid);
order.setDid(did);
order.setOquantity(oquantity);
order.setOprice(oprice);
order.setCid(cid);
order.setOdate(odate);
System.out.println(order);//检查。
boolean z=orderService.insertOrder(order);
if(z)
{
showOrderByPage(request,response);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void deleteOrderByOid(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is deleteOrderByOid....");
int oid=Integer.parseInt(request.getParameter("oid"));
boolean z= orderService.deleteOrderByOid(oid);
System.out.println("z:"+z);
if(z)
{
showOrderByPage(request,response);
}
}
public void showOrder(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showOrder.....");
List<Order> order=orderService.showOrder();
request.setAttribute("order", order);
request.getRequestDispatcher("order/index.jsp").forward(request, response);
}
public void showOrderByPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showOrderByPage.....");
String current_page=request.getParameter("current_page");
//先有鸡还是先有蛋。
int count_rows=orderService.counts();
{
showCustomerByPage(request,response);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void updateCustomerByCid(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is updateCustomerByCid....");
int cid=Integer.parseInt(request.getParameter("cid"));
//System.out.println(did);
Customer customer=customerService.showCustomerByCid(cid);
if(customer!=null)
{
request.setAttribute("customer", customer);
request.getRequestDispatcher("customer/edit.jsp").forward(request, response);
}
}
}
/**
* Servlet implementation class OrderServlet
*/
@WebServlet("/orderServlet.do")
public class OrderServlet extends BaseServlet{
private static final long serialVersionUID = 1L;
private OrderService orderService=new OrderService();
public void insertOrder(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is insertOrder....");
try {
System.out.println("this is logout...");
HttpSession session = request.getSession();
session.invalidate();
response.sendRedirect("login.jsp");
}
}
/**
* Servlet implementation class DrugServlet
*/
@WebServlet("/drugServlet.do")
public class DrugServlet extends BaseServlet {
private static final long serialVersionUID = 1L;
private DrugService drugService=new DrugService();
public void insertDrug(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is insertDrug....");
try {
String did=request.getParameter("did");
String dname=request.getParameter("dname");
String dclass=request.getParameter("dclass");
String dprice=request.getParameter("dprice");
String pro = request.getParameter("prodate");
public void updateSupplier(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is updateSupplier...");
try {
String sname=request.getParameter("sname");
String sphone=request.getParameter("sphone");
String saddress= request.getParameter("saddress");
Supplier supplier=new Supplier();
supplier.setSname(sname);
supplier.setSphone(sphone);
supplier.setSaddress(saddress);
//System.out.println(supplier);//检查。
boolean z=supplierService.updateSupplier(supplier);
if(z)
{
showSupplierByPage(request,response);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void updateSupplierBySname(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is updateSupplierBySname....");
String sname=request.getParameter("sname");
//System.out.println(did);
Supplier supplier=supplierService.showSupplierBySname(sname);
if(supplier!=null)
{
request.setAttribute("supplier", supplier);
request.getRequestDispatcher("supplier/edit.jsp").forward(request, response);
}
}
}
public class BaseServlet extends HttpServlet{
private static final long serialVersionUID = 1L;
java.sql.Date odate=java.sql.Date.valueOf(od);
Order order=new Order();
//order.setOid(oid);
order.setDid(did);
order.setOquantity(oquantity);
order.setOprice(oprice);
order.setCid(cid);
order.setOdate(odate);
System.out.println(order);//检查。
boolean z=orderService.insertOrder(order);
if(z)
{
showOrderByPage(request,response);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void deleteOrderByOid(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is deleteOrderByOid....");
int oid=Integer.parseInt(request.getParameter("oid"));
boolean z= orderService.deleteOrderByOid(oid);
System.out.println("z:"+z);
if(z)
{
showOrderByPage(request,response);
}
}
public void showOrder(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showOrder.....");
List<Order> order=orderService.showOrder();
request.setAttribute("order", order);
request.getRequestDispatcher("order/index.jsp").forward(request, response);
}
public void showOrderByPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showOrderByPage.....");
String current_page=request.getParameter("current_page");
//先有鸡还是先有蛋。
int count_rows=orderService.counts();
PageTools pt=new PageTools(current_page, count_rows);
admin.setAaddress(aaddress);
//System.out.println(admin);//检查。
boolean z=adminService.updateAdmin(admin);
if(z)
{
showAdminByPage(request,response);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void updateAdminByAid(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is updateAdminByAid....");
int aid=Integer.parseInt(request.getParameter("aid"));
//System.out.println(did);
Admin admin=adminService.showAdminByAid(aid);
if(admin!=null)
{
request.setAttribute("admin", admin);
request.getRequestDispatcher("admin/edit.jsp").forward(request, response);
}
}
//注册
public void regist(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is regist...");
String aname = request.getParameter("aname");// 真实姓名
String apassword = request.getParameter("apassword");
String aphone = request.getParameter("aphone");
String aaddress = request.getParameter("aaddress");
Admin admin = new Admin();
admin.setAname(aname);
admin.setApassword(apassword);
admin.setAphone(aphone);
admin.setAaddress(aaddress);
boolean z = adminService.insertAdmin(admin);
if (z) {
response.sendRedirect("login.jsp");
} else {
request.setAttribute("error", "注册失败");
request.getRequestDispatcher("regist.jsp").forward(request, response);
}
}
// checkLogin
public void checkLogin(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is checkLogin...");
public void showDrugByDid(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showDrugByDid....");
String did=request.getParameter("did");
Drug drug=drugService.showDrugByDid(did);
if(drug!=null)
{
request.setAttribute("drug",drug);
request.getRequestDispatcher("drug/index.jsp").forward(request, response);
}
}
public void updateDrug(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is updateDrug...");
try {
String did=request.getParameter("did");
String dname=request.getParameter("dname");
String dclass=request.getParameter("dclass");
String dprice=request.getParameter("dprice");
//SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
String pro =request.getParameter("prodate");
java.sql.Date prodate=java.sql.Date.valueOf(pro);
String ex =request.getParameter("exdate");
java.sql.Date exdate=java.sql.Date.valueOf(ex);
int requantity=Integer.parseInt(request.getParameter("requantity"));
String sname= request.getParameter("sname");
String function= request.getParameter("function");
Drug drug=new Drug();
drug.setDid(did);
drug.setDname(dname);
drug.setDclass(dclass);
drug.setDprice(dprice);
drug.setProdate(prodate);
drug.setExdate(exdate);
drug.setRequantity(requantity);
drug.setSname(sname);
drug.setFunction(function);
//System.out.println(drug);//检查。
boolean z=drugService.updateDrug(drug);
if(z)
{
showDrugByPage(request,response);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void updateDrugByDid(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is updateCustomer...");
try {
int cid=Integer.parseInt(request.getParameter("cid"));
String cname=request.getParameter("cname");
String csex=request.getParameter("csex");
int cage=Integer.parseInt(request.getParameter("cage"));
String cphone= request.getParameter("cphone");
String cemail= request.getParameter("cemail");
String caddress= request.getParameter("caddress");
Customer customer=new Customer();
customer.setCid(cid);
customer.setCname(cname);
customer.setCsex(csex);
customer.setCage(cage);
customer.setCphone(cphone);
customer.setCemail(cemail);
customer.setCaddress(caddress);
//System.out.println(customer);//检查。
boolean z=customerService.updateCustomer(customer);
if(z)
{
showCustomerByPage(request,response);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void updateCustomerByCid(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is updateCustomerByCid....");
int cid=Integer.parseInt(request.getParameter("cid"));
//System.out.println(did);
Customer customer=customerService.showCustomerByCid(cid);
if(customer!=null)
{
request.setAttribute("customer", customer);
request.getRequestDispatcher("customer/edit.jsp").forward(request, response);
}
}
}
if(z)
{
showSupplierByPage(request,response);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void deleteSupplierBySname(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is deleteSupplierBySname....");
String sname=request.getParameter("sname");
boolean z= supplierService.deleteSupplierBySname(sname);
System.out.println("z:"+z);
if(z)
{
showSupplierByPage(request,response);
}
}
public void showSupplier(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showSupplier.....");
List<Supplier> supplier=supplierService.showSupplier();
request.setAttribute("supplier", supplier);
request.getRequestDispatcher("supplier/index.jsp").forward(request, response);
}
public void showSupplierByPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showSupplierByPage.....");
String current_page=request.getParameter("current_page");
//先有鸡还是先有蛋。
int count_rows=supplierService.counts();
PageTools pt=new PageTools(current_page, count_rows);
List<Supplier> supplier=supplierService.showSupplierByPage(pt);
request.setAttribute("pt", pt);
request.setAttribute("supplier",supplier);
request.getRequestDispatcher("supplier/index.jsp").forward(request, response);
}
public void showSupplierBySname(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showSupplierBySname....");
String sname=request.getParameter("sname");
Supplier supplier=supplierService.showSupplierBySname(sname);
if(supplier!=null)
{
request.setAttribute("supplier",supplier);
request.getRequestDispatcher("supplier/edit.jsp").forward(request, response);
}
}
public void showAdminByAid(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is showAdminByAid....");
int aid=Integer.parseInt(request.getParameter("aid"));
Admin admin=adminService.showAdminByAid(aid);
if(admin!=null)
{
request.setAttribute("admin",admin);
request.getRequestDispatcher("admin/edit.jsp").forward(request, response);
}
}
public void updateAdmin(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is updateAdmin...");
try {
int aid=Integer.parseInt(request.getParameter("aid"));
String aname=request.getParameter("aname");
String apassword=request.getParameter("apassword");
String aphone= request.getParameter("aphone");
String aaddress= request.getParameter("aaddress");
Admin admin=new Admin();
admin.setAid(aid);
admin.setAname(aname);
admin.setApassword(apassword);
admin.setAphone(aphone);
admin.setAaddress(aaddress);
//System.out.println(admin);//检查。
boolean z=adminService.updateAdmin(admin);
if(z)
{
showAdminByPage(request,response);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void updateAdminByAid(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is updateAdminByAid....");
int aid=Integer.parseInt(request.getParameter("aid"));
//System.out.println(did);
request.setAttribute("supplier",supplier);
request.getRequestDispatcher("supplier/edit.jsp").forward(request, response);
}
}
public void updateSupplier(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is updateSupplier...");
try {
String sname=request.getParameter("sname");
String sphone=request.getParameter("sphone");
String saddress= request.getParameter("saddress");
Supplier supplier=new Supplier();
supplier.setSname(sname);
supplier.setSphone(sphone);
supplier.setSaddress(saddress);
//System.out.println(supplier);//检查。
boolean z=supplierService.updateSupplier(supplier);
if(z)
{
showSupplierByPage(request,response);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void updateSupplierBySname(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("this is updateSupplierBySname....");
String sname=request.getParameter("sname");
//System.out.println(did);
Supplier supplier=supplierService.showSupplierBySname(sname);
if(supplier!=null)
{
request.setAttribute("supplier", supplier);
request.getRequestDispatcher("supplier/edit.jsp").forward(request, response);
}
}
}
public class BaseServlet extends HttpServlet{
private static final long serialVersionUID = 1L;
@Override