资源简介

代码全,有数据库,是MySQL

资源截图

代码片段和文件信息

package com.cl.shopping.action;

import java.io.File;
import java.io.IOException;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.io.FileUtils;
import org.apache.struts2.ServletActionContext;

import com.cl.shopping.bean.GoodTypes;
import com.cl.shopping.bean.Goods;
import com.cl.shopping.service.GoodsService;
import com.opensymphony.xwork2.ModelDriven;

public class AddgoodsAction implements ModelDriven{
private GoodsService goodsService;
private Goods goods = new Goods();
//用户头像
private File pic;
//Struts 提供的得到文件名的方式,  属性名+FileName
private String picFileName;


public void setGoodsService(GoodsService goodsService) {
this.goodsService = goodsService;
}

public String execute()
{
//获取服务器路径   D:\ JavaWeb \  apache-tomcat-7.0.30 \  webapps \s sh2shoping \ upload
String path = ServletActionContext.getServletContext().getRealPath(“/upload“);
//这个方式确实可以获得
// HttpServletRequest request = ServletActionContext.getRequest();
// String roles = request.getParameter(“goodtypes“);
//商品的分类还是获取 null 

// goods.setGoodtypes();
if(pic != null){
String name = System.currentTimeMillis() + picFileName.substring(picFileName.lastIndexOf(“.“));
File savefile = new File(pathname);
try {
FileUtils.copyFile(pic savefile);
goods.setGoodspic(“upload/“+name);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else{
//设置默认的图片
goods.setGoodspic(“upload/0000.jpg“);
}

goodsService.saveGoods(goods);
return “success“;
}

public Goods getModel() {
// TODO Auto-generated method stub
return goods ;
}

public File getPic() {
return pic;
}

public void setPic(File pic) {
this.pic = pic;
}

public String getPicFileName() {
return picFileName;
}

public void setPicFileName(String picFileName) {
this.picFileName = picFileName;
}





};

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

     文件       5496  2016-01-12 20:15  ssh2shoping\.classpath

     文件        306  2016-12-07 01:02  ssh2shoping\.mymetadata

     文件       1754  2016-01-08 22:40  ssh2shoping\.project

     文件        500  2016-01-08 16:33  ssh2shoping\.settings\.jsdtscope

     文件        364  2016-01-08 16:33  ssh2shoping\.settings\org.eclipse.jdt.core.prefs

     文件        471  2016-01-08 16:33  ssh2shoping\.settings\org.eclipse.wst.common.component

     文件        252  2016-01-08 16:33  ssh2shoping\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2016-01-08 16:33  ssh2shoping\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2016-01-08 16:33  ssh2shoping\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件      11841  2016-01-15 16:58  ssh2shoping\ReadMe.txt

     文件       2701  2016-12-07 14:58  ssh2shoping\sql\tbl_goods.sql

     文件       2090  2016-12-07 14:58  ssh2shoping\sql\tbl_goods_board.sql

     文件        658  2016-12-07 14:58  ssh2shoping\sql\tbl_goods_car.sql

     文件       1272  2016-12-07 14:58  ssh2shoping\sql\tbl_goods_type.sql

     文件       1410  2016-12-07 14:58  ssh2shoping\sql\tbl_order.sql

     文件       3468  2016-12-07 14:58  ssh2shoping\sql\tbl_order_detail.sql

     文件       1135  2016-12-07 14:58  ssh2shoping\sql\tbl_user.sql

     文件        749  2016-12-07 14:58  ssh2shoping\sql\tbl_user_role.sql

     文件       2083  2016-01-12 14:41  ssh2shoping\src\com\cl\shopping\action\AddgoodsAction.java

     文件       5920  2016-01-15 09:08  ssh2shoping\src\com\cl\shopping\action\CarAction.java

     文件       1933  2016-01-15 14:53  ssh2shoping\src\com\cl\shopping\action\ClassificGoodsAction.java

     文件       1660  2016-01-13 22:57  ssh2shoping\src\com\cl\shopping\action\GoodBoardsAction.java

     文件       4513  2016-01-15 14:25  ssh2shoping\src\com\cl\shopping\action\GoodsAction.java

     文件       3673  2016-01-13 13:46  ssh2shoping\src\com\cl\shopping\action\GoodTypesAction.java

     文件       7099  2016-01-15 11:09  ssh2shoping\src\com\cl\shopping\action\OrderAction.java

     文件       1567  2016-01-15 10:55  ssh2shoping\src\com\cl\shopping\action\OrderDetailAction.java

     文件       1087  2016-01-12 20:53  ssh2shoping\src\com\cl\shopping\action\RoleAction.java

     文件       1521  2016-01-10 18:27  ssh2shoping\src\com\cl\shopping\action\SecurityCodeImageAction.java

     文件       5130  2016-01-15 16:18  ssh2shoping\src\com\cl\shopping\action\UserAction.java

     文件       2766  2016-01-15 16:55  ssh2shoping\src\com\cl\shopping\action\UserGoodsAction.java

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

评论

共有 条评论