package com.wy.webtier;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForward;
import com.wy.domain.GoodsForm;
import org.apache.struts.action.Action;
import org.apache.struts.upload.FormFile;
import com.wy.dao.GoodsDao;
import java.util.List;
import com.wy.dao.SmallTypeDao;
import com.wy.tool.*;
import javax.servlet.http.HttpSession;
import java.io.UnsupportedEncodingException;
//商品的Action
public class GoodsAction extends Action {
private int action;
private GoodsDao dao = null;
private SmallTypeDao small = null;
private HttpSession session = null;
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
request.setCharacterEncoding("gb2312");
this.dao = new GoodsDao();
small = new SmallTypeDao();
action = Integer.parseInt(request.getParameter("action"));
session = request.getSession();
switch (action) {
case 0: {
return goodSelect(mapping, form, request, response); // 全部查询小类别信息
}
case 1: {
return goodForward(mapping, form, request, response); // 转向页面
}
case 2: {
return selectSmallName(mapping, form, request, response); // 查询小类别的名称
}
case 3: {
return saveGoods(mapping, form, request, response); // 把从页面中信息存储在bean中
}
case 5: {
return selectOneGoods(mapping, form, request, response); // 查看商品的详细信息
}
case 6: {
return deleteGoods(mapping, form, request, response); // 删除商品信息
}
case 7: {
return goodSelectMark(mapping, form, request, response); // 按特价商品信息查询
}
case 8: {
return goodSelectSmall(mapping, form, request, response); // 按小类别商品信息查询
}
case 9: {
return goodSelectBig(mapping, form, request, response); // 按大类别商品信息查询
}
case 10: {
return managerFreePirceForward(mapping, form, request, response); // 转向特价商品页面
}
case 11: {
return managerFreePirce(mapping, form, request, response); // 设置特价价格
}
case 12: {
return goodSelectBigHead(mapping, form, request, response); // 按大类别商品信息查询商品和商品小类别的名称
}
case 13: {
return goodSelectSmallHead(mapping, form, request, response); // 按小类别商品信息查询商品和商品小类别的名称
}
case 14: {
return goodSelectNewHead(mapping, form, request, response); // 新品查询
}
case 15: {
return goodSelectFreeHead(mapping, form, request, response); // 特价商品
}
case 16: {
return goodSelectOneHead(mapping, form, request, response); // 前台单独查询商品的信息
}
}
GoodsForm goodsForm = (GoodsForm) form;
throw new java.lang.UnsupportedOperationException(
"Method $execute() not yet implemented.");
}
// 前台单独查询商品的信息
public ActionForward goodSelectOneHead(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
request.setAttribute("form", dao.selectOneGoods(Integer.valueOf(request
.getParameter("id"))));
return mapping.findForward("goodSelectOneHead");
}
// 特价商品
public ActionForward goodSelectFreeHead(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
List list = null;
String mark = request.getParameter("mark");
list = dao.selectMark(Integer.valueOf(mark));
int pageNumber = list.size(); // 计算出有多少条记录
int maxPage = pageNumber; // 计算有多少页数
String number = request.getParameter("i");
if (maxPage % 4 == 0) {
maxPage = maxPage / 4;
} else {
maxPage = maxPage / 4 + 1;
}
if (number == null) {
number = "0";
}
request.setAttribute("number", String.valueOf(number));
request.setAttribute("maxPage", String.valueOf(maxPage));
request.setAttribute("pageNumber", String.valueOf(pageNumber));
request.setAttribute("list", list);
return mapping.findForward("goodSelectFreeHead");
}
// 新品查询
public ActionForward goodSelectNewHead(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
List list = null;
String mark = request.getParameter("mark");
list = dao.selectMark(Integer.valueOf(mark));
request.setAttribute("list", list);
return mapping.findForward("goodSelectNewHead");
}
// 按小类别商品信息查询商品和商品小类别的名称
public ActionForward goodSelectSmallHead(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
List list = null;
list = dao.selectSmall(Integer.valueOf(request.getParameter("small")));
int pageNumber = list.size(); // 计算出有多少条记录
int maxPage = pageNumber; // 计算有多少页数
String number = request.getParameter("i");
if (maxPage % 4 == 0) {
maxPage = maxPage / 4;
} else {
maxPage = maxPage / 4 + 1;
}
if (number == null) {
number = "0";
}
request.setAttribute("number", String.valueOf(number));
request.setAttribute("maxPage", String.valueOf(maxPage));
request.setAttribute("pageNumber", String.valueOf(pageNumber));
request.setAttribute("list", list);
request.setAttribute("smallList", small.selectOneBigId(Integer
.valueOf(request.getParameter("big"))));
return mapping.findForward("goodSelectSmallHead");
}
// 按大类别商品信息查询商品和商品小类别的名称
public ActionForward goodSelectBigHead(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
List list = null;
list = dao.selectBig(Integer.valueOf(request.getParameter("big")));
int pageNumber = list.size(); // 计算出有多少条记录
int maxPage = pageNumber; // 计算有多少页数
String number = request.getParameter("i");
if (maxPage % 4 == 0) {
maxPage = maxPage / 4;
} else {
maxPage = maxPage / 4 + 1;
}
if (number == null) {
number = "0";
}
request.setAttribute("number", String.valueOf(number));
request.setAttribute("maxPage", String.valueOf(maxPage));
request.setAttribute("pageNumber", String.valueOf(pageNumber));
request.setAttribute("list", list);
request.setAttribute("smallList", small.selectOneBigId(Integer
.valueOf(request.getParameter("big"))));
return mapping.findForward("goodSelectBigHead");
}
// 设置特价价格
public ActionForward managerFreePirce(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
GoodsForm goodsForm = (GoodsForm) form;
String mark = request.getParameter("mark").trim();
String id = request.getParameter("id").trim();
if (mark.equals("0")) {
goodsForm.setFreePrice(Float.valueOf("0"));
goodsForm.setMark(Integer.valueOf("0"));
goodsForm.setId(Integer.valueOf(id));
dao.managerPrice(goodsForm);
request.setAttribute("result", "删除特价成功!!");
} else {
String free = request.getParameter("free").trim();
goodsForm.setFreePrice(Float.valueOf(free));
goodsForm.setMark(Integer.valueOf(mark));
goodsForm.setId(Integer.valueOf(id));
dao.managerPrice(goodsForm);
request.setAttribute("result", "设置特价成功!!");
}
return mapping.findForward("goodsOperation");
}
// 转向特价商品页面
public ActionForward managerFreePirceForward(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
request.setAttribute("form", dao.selectOneGoods(Integer.valueOf(request
.getParameter("id"))));
return mapping.findForward("managerFreePirce");
}
// 按大类别商品信息查询
public ActionForward goodSelectBig(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
List list = null;
list = dao.selectBig(Integer.val
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
java期末大作业 基于Java+JSP实现的企业电子商城系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的企业电子商城系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的企业电子商城系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的企业电子商城系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的企业电子商城系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的企业电子商城系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的企业电子商城系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的企业电子商城系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的企业电子商城系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的企业电子商城系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的企业电子商城系统源码(含SQL数据库文件)
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
共 204 条
- 1
- 2
- 3
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/3cf9595250a245598e08e92712371b3b_p445098355.jpg!1)
柯晓楠
- 粉丝: 2w+
- 资源: 2650
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- 8051Proteus仿真c源码用单片机控制直流电机
- 8051Proteus仿真c源码用不同数据类型控制灯闪烁时间
- 图像检索-基于交叉视图使用卫星图像进行高精度车辆定位算法-附项目源码-优质项目实战.zip
- 基于stm32的通信系统,sim800c与服务器通信,无线通信监测,远程定位,服务器通信系统,gps,sim800c,心率,温度
- 8051Proteus仿真c源码用T0控制LED灯闪烁间隔
- 8051Proteus仿真c源码用swtich语句的控制P0口8位LED的点亮状态
- 宾得SILKYPIX Developer Studio 3.0
- 面试经验产品经理面试常见20个问题汇总
- 8051Proteus仿真c源码用P1口显示红外遥控器的按键值
- k8s-package.tar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)