/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.LineWell.struts.action;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.domain.Good;
import com.service.GoodService;
import com.util.PageBean;
/**
* MyEclipse Struts Creation date: 07-03-2014
*
* XDoclet definition:
*
* @struts.action path="/org.apache.struts.action.Loginform"
* name="org.apache.struts.action.LoginformForm"
* input="/form/org.apache.struts.action.Loginform.jsp"
* scope="request" validate="true"
*/
public class PageAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException {
String flag=request.getParameter("flag");
if(flag == null){
flag = (String) request.getSession().getAttribute("flag");
}
String pageNoStr=request.getParameter("pageNo");
int pageNo;
if (pageNoStr != null) {
pageNo = Integer.valueOf(pageNoStr);
}else{
pageNo = 1;
}
List<Good> goodList = new ArrayList<Good>();
int totalCount = 0;
int select=0;
if(flag!=null){
select=Integer.parseInt(flag);
}
PageBean<Good> pageBean = new PageBean<Good>();
String goodname = "";
GoodService goodService = new GoodService();
switch (select) {
case 1:
request.getSession().setAttribute("flag", flag);
goodname = new String(request.getParameter("goodname").getBytes("ISO-8859-1"),"UTF-8");
if(goodname != null){
request.getSession().setAttribute("goodname", goodname);
}else{
goodname = (String) request.getSession().getAttribute("goodname");
}
totalCount = goodService.findGoodCnt(goodname);
goodList = goodService.findGoodDat(goodname, pageNo, 6);
pageBean.setData(goodList);
pageBean.setPageNo(pageNo);
pageBean.setPageSize(6);
pageBean.setTotalCount(totalCount);
pageBean.setTotalPage(pageBean.getTotalPage());
request.setAttribute("pageBean", pageBean);
break;
case 2:
request.getSession().setAttribute("flag", flag);
String type=request.getParameter("type");
if(type != null){
request.getSession().setAttribute("type", type);
}else{
type = (String) request.getSession().getAttribute("type");
}
totalCount = goodService.findGoodByTypeCnt(type);
goodList = goodService.findGoodByTypeDat(type, pageNo, 6);
pageBean.setData(goodList);
pageBean.setPageNo(pageNo);
pageBean.setPageSize(6);
pageBean.setTotalCount(totalCount);
pageBean.setTotalPage(pageBean.getTotalPage());
request.setAttribute("pageBean", pageBean);
break;
case 3:
request.getSession().setAttribute("flag", flag);
totalCount = goodService.findAllCnt();
goodList = goodService.findAllDat(pageNo, 6);
pageBean.setData(goodList);
pageBean.setPageNo(pageNo);
pageBean.setPageSize(6);
pageBean.setTotalCount(totalCount);
pageBean.setTotalPage(pageBean.getTotalPage());
request.setAttribute("pageBean", pageBean);
break;
case 4:
goodname=new String(request.getParameter("goodname").getBytes("ISO-8859-1"),"UTF-8");
Good good = goodService.findOne(goodname);
request.getSession().setAttribute("Good", good);
return mapping.findForward("showgood");
default:
break;
}
return mapping.findForward("success");
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
基于MVC设计模式的JSP团购网站 (116个子文件)
ShopAction.class 4KB
PageAction.class 3KB
GoodDao.class 3KB
HibernateUtil.class 3KB
Cart.class 2KB
CartDao.class 2KB
PageBean.class 2KB
RegisterAction.class 2KB
LoginAction.class 2KB
Good.class 2KB
GoodService.class 2KB
UserDao.class 2KB
CartService.class 1KB
LogoutAction.class 1KB
RegisterForm.class 1KB
LoginForm.class 1KB
User.class 1KB
UserService.class 1KB
LogoutForm.class 811B
PageForm.class 805B
ShopForm.class 805B
.classpath 919B
style.css 6KB
search.css 1KB
Thumbs.db 18KB
Thumbs.db 8KB
Thumbs.db 6KB
divcss5-so-bg.gif 1KB
register.html 2KB
login.html 2KB
registerFalut.html 1KB
loginFalut.html 1KB
registerSuccess.html 1KB
mysql-connector-java-5.1.26-bin.jar 836KB
standard.jar 384KB
jstl.jar 20KB
PageAction.java 4KB
ShopAction.java 4KB
GoodDao.java 3KB
Cart.java 2KB
HibernateUtil.java 2KB
Good.java 2KB
RegisterAction.java 2KB
CartDao.java 2KB
LoginAction.java 2KB
PageBean.java 2KB
LogoutAction.java 1KB
UserDao.java 1KB
GoodService.java 1KB
User.java 1KB
RegisterForm.java 1KB
LoginForm.java 1KB
LogoutForm.java 707B
PageForm.java 705B
ShopForm.java 703B
CartService.java 671B
UserService.java 606B
phone06.jpg 366KB
bg.jpg 164KB
title.jpg 91KB
phone07.jpg 34KB
phone05.jpg 27KB
computer02.jpg 24KB
computer01.jpg 21KB
phone03.jpg 21KB
phone01.jpg 19KB
phone04.jpg 19KB
L_pay.jpg 18KB
buy.jpg 18KB
phone02.jpg 17KB
del.jpg 12KB
pay.jpg 12KB
shopcart.jpg 10KB
shopcart_small.jpg 8KB
login.jpg 2KB
register.jpg 1KB
jquery-1.8.0.min.js 90KB
formCheck.js 2KB
common_Util.js 629B
search.js 224B
onLoad.js 181B
shopcart.js 176B
shopcart.jsp 6KB
index.jsp 6KB
showGood.jsp 4KB
.struts-config.mex 6KB
MANIFEST.MF 39B
.myhibernatedata 480B
.mymetadata 309B
.mystrutsdata 262B
logo.png 18KB
login.png 1KB
register.png 1KB
org.eclipse.wst.validation.prefs 2KB
org.eclipse.core.resources.prefs 228B
.project 1KB
ApplicationResources.properties 95B
ApplicationResources.properties 95B
20140708 1412.sql 4KB
struts-html.tld 72KB
共 116 条
- 1
- 2
资源评论
虎牙_
- 粉丝: 0
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功