• 大小: 16.12MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-08
  • 语言: Java
  • 标签: javaweb  ssh  

资源简介

课程设计---java web项目,内含源代码及sql文件,演示视频在上次上传的文档中

资源截图

代码片段和文件信息

package yk.action;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;

import org.apache.struts2.interceptor.RequestAware;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

import yk.entity.Cart;
import yk.entity.Members;
import yk.entity.Product;
import yk.service.ICartService;
import yk.service.IMembersService;
import yk.service.IProductService;

public class CartAction extends ActionSupport implements ModelDrivenRequestAware {

private Cart cart = new Cart();
public void setCart(Cart cart) {
this.cart = cart;
}
public Cart getCart() {
return cart;
}

private Product product = new Product();
public void setProduct(Product product) {
this.product = product;
}
public Product getProduct() {
return product;
}

private Members members = new Members();
public void setMembers(Members members) {
this.members = members;
}
public Members getMembers() {
return members;
}

private Mapject> request;
@Override
public void setRequest(Mapject> request) {
this.request = request;
}

@Override
public Cart getModel() {
return cart;
}

private IMembersService membersService;
public void setMembersService(IMembersService membersService) {
this.membersService = membersService;
}
public IMembersService getMembersService() {
return membersService;
}

private int productId;
public void setProductId(int productId) {
this.productId = productId;
}
public int getProductId() {
return productId;
}

private IProductService productService;
public void setProductService(IProductService productService) {
this.productService = productService;
}
public IProductService getProductService() {
return productService;
}

private ICartService cartService;
public void setCartService(ICartService cartService) {
this.cartService = cartService;
}
public ICartService getCartService() {
return cartService;
}

public String addCart() throws Exception {

Members members =  (Members) ActionContext.getContext().getSession().get(“membersInfo“);
if(members == null){
return “login“;
}

Set ca = members.getCart();
Iterator it = ca.iterator();
while(it.hasNext()){
Cart next = it.next();
int pid =next.getProductid();
if(pid == productId){

next.setProductnumber(next.getProductnumber()+1);
next.setTotalprice(next.getProductnumber()*next.getProductprice());

next.setMembers(members);

cartService.update(next);

ActionContext.getContext().getSession().put(“membersInfo“ membersService.findById(members.getId()));

return “listCartInfo“;
}
}

Product productInfo = productService.findById(productId);

int id = productInfo.getId();
String name = productInfo.getName();
int numbe

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        4503  2017-07-02 22:53  2017-7-2-supermarket.sql
     目录           0  2017-07-02 22:52  Supermarket\
     文件        3583  2017-06-20 22:38  Supermarket\.classpath
     文件        1269  2017-06-20 22:38  Supermarket\.project
     目录           0  2017-07-02 22:52  Supermarket\.settings\
     文件         564  2017-06-10 20:53  Supermarket\.settings\.jsdtscope
     文件          79  2017-06-20 22:38  Supermarket\.settings\com.genuitec.eclipse.migration.prefs
     文件         364  2017-06-10 20:53  Supermarket\.settings\org.eclipse.jdt.core.prefs
     文件         492  2017-06-10 23:43  Supermarket\.settings\org.eclipse.wst.common.component
     文件         172  2017-06-20 22:38  Supermarket\.settings\org.eclipse.wst.common.project.facet.core.prefs.xml
     文件         462  2017-06-20 22:38  Supermarket\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2017-06-10 20:53  Supermarket\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2017-06-10 20:53  Supermarket\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2017-07-02 22:52  Supermarket\WebRoot\
     目录           0  2017-07-02 22:52  Supermarket\WebRoot\meta-INF\
     文件          39  2017-06-10 20:53  Supermarket\WebRoot\meta-INF\MANIFEST.MF
     目录           0  2017-07-02 22:52  Supermarket\WebRoot\WEB-INF\
     目录           0  2017-07-02 22:52  Supermarket\WebRoot\WEB-INF\back\
     目录           0  2017-07-02 22:52  Supermarket\WebRoot\WEB-INF\back\members\
     文件        2522  2017-06-28 18:17  Supermarket\WebRoot\WEB-INF\back\members\addMem.jsp
     文件        2756  2017-07-02 19:51  Supermarket\WebRoot\WEB-INF\back\members\listMembers.jsp
     文件        2876  2017-06-28 18:29  Supermarket\WebRoot\WEB-INF\back\members\updateMem.jsp
     目录           0  2017-07-02 22:52  Supermarket\WebRoot\WEB-INF\back\order\
     文件        2553  2017-06-29 08:28  Supermarket\WebRoot\WEB-INF\back\order\backlistAllOrders.jsp
     文件        2334  2017-06-28 12:24  Supermarket\WebRoot\WEB-INF\back\order\backlistOrderone.jsp
     文件        2252  2017-06-28 12:24  Supermarket\WebRoot\WEB-INF\back\order\backlistorderInfo.jsp
     目录           0  2017-07-02 22:52  Supermarket\WebRoot\WEB-INF\back\product\
     文件        3025  2017-06-28 12:23  Supermarket\WebRoot\WEB-INF\back\product\addProduct.jsp
     文件        4027  2017-06-28 12:22  Supermarket\WebRoot\WEB-INF\back\product\listProduct.jsp
     文件        3317  2017-06-28 12:23  Supermarket\WebRoot\WEB-INF\back\product\updateProduct.jsp
     目录           0  2017-07-02 22:52  Supermarket\WebRoot\WEB-INF\classes\
............此处省略190个文件信息

评论

共有 条评论