• 大小: 5.47MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-11-01
  • 语言: Java
  • 标签: Java  CURD  

资源简介

Java+mySQL实现的购物商城项目

资源截图

代码片段和文件信息

package com.shopping.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.shopping.bean.Admins;
import com.shopping.service.AdminEmployeeService;
import com.shopping.service.impl.AdminEmployeeServiceImpl;

public class AdminEmployeeAction extends HttpServlet {
//调用业务层
private AdminEmployeeService adminEmployeeService =new AdminEmployeeServiceImpl();
public void doGet(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
doPost(request response);
}

public void doPost(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
request.setCharacterEncoding(“utf-8“);
response.setContentType(“text/html;charset=utf-8“);

String action=request.getParameter(“action“);
//查询全部
if(“all“.equals(action)){
//接受姓名
String name=request.getParameter(“name“);
List adminslist=adminEmployeeService.getAll(name);
request.setAttribute(“adminslist“ adminslist);
//重定向
request.getRequestDispatcher(“/admin/dian_yuan.jsp“).forward(request response);
}

//跳转到新增页面
if(“insertUI“.equals(action)){
request.getRequestDispatcher(“/admin/dian_yuan_add.jsp“).forward(request response);
}

//进行新增操作
if(“insert“.equals(action)){
String name=request.getParameter(“name“);
String pwd=request.getParameter(“pwd“);
int age=Integer.parseInt(request.getParameter(“age“));
String gender=request.getParameter(“sex“);
String address=request.getParameter(“address“);
String phone=request.getParameter(“phone“);
int result =adminEmployeeService.insert(namepwdagegenderaddressphone);
if(result == 1){
response.sendRedirect(“AdminEmployeeAction?action=all“);
}
}

//跳转到修改页面
if(“updateUI“.equals(action)){
int id=Integer.parseInt(request.getParameter(“id“));
//根据id获取对象
Admins admin=adminEmployeeService.getById(id);
request.setAttribute(“admin“ admin);
request.getRequestDispatcher(“/admin/dian_yuan_edit.jsp“).forward(request response);
}

//进行修改操作
if(“update“.equals(action)){
int id=Integer.parseInt(request.getParameter(“id“));
String name=request.getParameter(“name“);
int age=Integer.parseInt(request.getParameter(“age“));
String gender=request.getParameter(“sex“);
String address=request.getParameter(“address“);
String phone=request.getParameter(“phone“);
int result =adminEmployeeService.update(nameagegenderaddressphoneid);
if(result == 1){
response.sendRedirect(“AdminEmployeeAction?action=all“);
}
}

//进行删除操作
if(“delete“.equals(action)){
int id=Integer.parseInt(request.getParameter(“id“));
int result=adminEmployeeService.deleteById(id);
if

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件    5242880  2016-01-14 20:00  002一起购1.0\Database\shopping.mdf

     文件    2097152  2016-01-14 20:00  002一起购1.0\Database\shopping_log.ldf

     文件        529  2016-01-14 19:57  002一起购1.0\shopping\.classpath

     文件        297  2016-04-12 22:25  002一起购1.0\shopping\.mymetadata

     文件       1751  2016-01-14 19:57  002一起购1.0\shopping\.project

     文件        500  2016-01-14 19:57  002一起购1.0\shopping\.settings\.jsdtscope

     文件        469  2016-01-14 19:57  002一起购1.0\shopping\.settings\com.genuitec.eclipse.core.prefs

     文件       1009  2016-01-14 19:57  002一起购1.0\shopping\.settings\com.genuitec.eclipse.j2eedt.core.prefs

     文件        326  2016-01-14 19:57  002一起购1.0\shopping\.settings\org.eclipse.core.resources.prefs

     文件        364  2016-01-14 19:57  002一起购1.0\shopping\.settings\org.eclipse.jdt.core.prefs

     文件        462  2016-01-14 19:57  002一起购1.0\shopping\.settings\org.eclipse.wst.common.component

     文件        252  2016-01-14 19:57  002一起购1.0\shopping\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2016-01-14 19:57  002一起购1.0\shopping\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2016-01-14 19:57  002一起购1.0\shopping\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件       3206  2016-01-14 19:57  002一起购1.0\shopping\src\com\shopping\action\AdminEmployeeAction.java

     文件       6172  2016-01-14 19:57  002一起购1.0\shopping\src\com\shopping\action\AdminGoodsAction.java

     文件       3219  2016-01-14 19:57  002一起购1.0\shopping\src\com\shopping\action\AdminLoginAction.java

     文件       1626  2016-01-14 19:57  002一起购1.0\shopping\src\com\shopping\action\AdminOrdersAction.java

     文件       2392  2016-01-14 19:57  002一起购1.0\shopping\src\com\shopping\action\AdminUsersAction.java

     文件       2573  2016-01-14 19:57  002一起购1.0\shopping\src\com\shopping\action\ShowGwcAction.java

     文件       1602  2016-01-14 19:57  002一起购1.0\shopping\src\com\shopping\action\ShowIndexGoodsAction.java

     文件       1191  2016-01-14 19:57  002一起购1.0\shopping\src\com\shopping\action\ShowIndexMrtjAction.java

     文件       2405  2016-01-14 19:57  002一起购1.0\shopping\src\com\shopping\action\ShowLoginAction.java

     文件       2242  2016-01-14 19:57  002一起购1.0\shopping\src\com\shopping\action\ShowShoppingAction.java

     文件       1573  2016-01-14 19:57  002一起购1.0\shopping\src\com\shopping\bean\Admins.java

     文件        640  2016-01-14 19:57  002一起购1.0\shopping\src\com\shopping\bean\Boss.java

     文件       3558  2016-01-14 19:57  002一起购1.0\shopping\src\com\shopping\bean\Goods.java

     文件       2498  2016-01-14 19:57  002一起购1.0\shopping\src\com\shopping\bean\Orders.java

     文件       3604  2016-01-14 19:57  002一起购1.0\shopping\src\com\shopping\bean\Tuijian.java

     文件       1365  2016-01-14 19:57  002一起购1.0\shopping\src\com\shopping\bean\Users.java

............此处省略300个文件信息

评论

共有 条评论