资源简介
网上书城onlineBookStore+struts+hibernate
代码片段和文件信息
package com.onlineBookStore.action;
import java.io.IOException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import net.sf.json.JSONArray;
import net.sf.json.JSONobject;
import org.apache.struts2.ServletActionContext;
import com.onlineBookStore.pojo.BookCar;
import com.onlineBookStore.pojo.Bookinfo;
import com.onlineBookStore.pojo.Order;
import com.onlineBookStore.pojo.Userinfo;
import com.onlineBookStore.service.BookinfoService;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
public class BookCarAction extends ActionSupport {
/**
*
*/
private static final long serialVersionUID = 3320254023162195908L;
private int bookId;
// private Map cookie;
private BookinfoService bs = new BookinfoService();
private int remaining;
public void addBookCar() throws Exception {
ActionContext context = ActionContext.getContext();
HttpServletResponse response = (HttpServletResponse) context
.get(ServletActionContext.HTTP_RESPONSE);
HttpServletRequest request = (HttpServletRequest) context
.get(ServletActionContext.HTTP_REQUEST);
String msg = null;
Mapject> session = context.getSession();
Bookinfo book = bs.getBookById(bookId);
List bookCars = (List) session.get(“bookCars“);
if (book.getRemaining() > 0&&bs.deleteBookRemaining(book)) {
BookCar bookCar=new BookCar();
bookCar.setBookId(book.getId());
bookCar.setBookName(book.getBookName());
bookCar.setBookNumber(1);
bookCar.setWriter(book.getWriter());
bookCar.setPrice(book.getPrice());
boolean temp = false;
if (bookCars == null) {
bookCars = new ArrayList();
bookCars.add(bookCar);
} else {
for (int i = 0; i < bookCars.size(); i++) {
if (bookCar.getBookId() == bookCars.get(i).getBookId()) {
bookCars.get(i).setBookNumber(
bookCars.get(i).getBookNumber() + 1);
temp = true;
break;
}
}
if(temp==false){
bookCars.add(bookCar);
}
}
session.put(“bookCars“ bookCars);
msg=“已添加到购物车“;
}else {
msg = “该图书暂时无货“;
}
// int bookid=book.getId();
// System.out.println(bookCar);
response.setContentType(“text/html; charset=utf-8“);
response.getWriter().write(msg);
response.getWriter().flush();
response.getWriter().close();
}
public void addBookCar_1() throws Exception {
ActionContext context = ActionContext.getContext();
HttpServletResponse response = (HttpServletResponse) context
.get(ServletActionContext.HTTP_RESPONSE);
HttpServletRequest request = (HttpServletReques
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1386 2014-11-16 15:58 onlineBookStore\.classpath
文件 486 2014-11-20 17:11 onlineBookStore\.myhibernatedata
文件 1340 2014-11-16 16:06 onlineBookStore\.project
文件 522 2014-11-16 15:43 onlineBookStore\.settings\.jsdtscope
文件 69 2014-11-22 18:32 onlineBookStore\.settings\org.eclipse.core.resources.prefs
文件 364 2014-11-16 15:43 onlineBookStore\.settings\org.eclipse.jdt.core.prefs
文件 504 2014-11-16 15:43 onlineBookStore\.settings\org.eclipse.wst.common.component
文件 465 2014-11-16 15:58 onlineBookStore\.settings\org.eclipse.wst.common.project.facet.core.xm
文件 49 2014-11-16 15:43 onlineBookStore\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 6 2014-11-16 15:43 onlineBookStore\.settings\org.eclipse.wst.jsdt.ui.superType.name
文件 6585 2014-12-11 17:11 onlineBookStore\src\com\onlineBookStore\action\BookCarAction.java
文件 6149 2014-11-29 20:41 onlineBookStore\src\com\onlineBookStore\action\BookinfoAction.java
文件 1248 2014-11-29 17:05 onlineBookStore\src\com\onlineBookStore\action\OrderAction.java
文件 3028 2014-11-30 15:52 onlineBookStore\src\com\onlineBookStore\action\RemarkAction.java
文件 4264 2014-12-10 20:54 onlineBookStore\src\com\onlineBookStore\action\SearchBookAction.java
文件 3959 2014-11-29 17:05 onlineBookStore\src\com\onlineBookStore\action\UserinfoAction.java
文件 1011 2014-11-21 11:50 onlineBookStore\src\com\onlineBookStore\cfg\Addressinfo.hbm.xm
文件 2410 2014-11-28 16:25 onlineBookStore\src\com\onlineBookStore\cfg\Bookinfo.hbm.xm
文件 1474 2014-11-21 11:48 onlineBookStore\src\com\onlineBookStore\cfg\Order.hbm.xm
文件 1186 2014-11-21 11:50 onlineBookStore\src\com\onlineBookStore\cfg\Remark.hbm.xm
文件 1639 2014-11-22 17:30 onlineBookStore\src\com\onlineBookStore\cfg\Userinfo.hbm.xm
文件 3988 2014-11-29 17:05 onlineBookStore\src\com\onlineBookStore\dao\AddressinfoDAO.java
文件 381 2014-11-29 17:05 onlineBookStore\src\com\onlineBookStore\dao\ba
文件 3892 2014-11-29 17:05 onlineBookStore\src\com\onlineBookStore\dao\BookinfoDAO.java
文件 237 2014-11-29 17:05 onlineBookStore\src\com\onlineBookStore\dao\Iba
文件 3798 2014-11-29 17:05 onlineBookStore\src\com\onlineBookStore\dao\OrderDAO.java
文件 3828 2014-11-29 17:05 onlineBookStore\src\com\onlineBookStore\dao\RemarkDAO.java
文件 3892 2014-11-29 17:05 onlineBookStore\src\com\onlineBookStore\dao\UserinfoDAO.java
文件 1264 2014-11-20 17:12 onlineBookStore\src\com\onlineBookStore\pojo\Addressinfo.java
文件 821 2014-12-11 14:27 onlineBookStore\src\com\onlineBookStore\pojo\BookCar.java
............此处省略123个文件信息
相关资源
- SHT10相关资料及源码实现
- SiI9136-3数据手册+寄存器配置+驱动
- flash小游戏源文件
- Flash_Loader_Demonstrator_V1.3_Setup
- FRM 2020二级 公示表 Quicksheet 最新
- 最权威的Linux BASH Shell 编程中文官方文
- 黑龙江省乡镇级区划图 shp格式
- [MSDN]Csharp编程指南+参考手册lyf
- OpenGL阴影的最简单实现Demo非阴影锥
- Reverse_Engineering_for_Beginners - english pd
- LearningFromData_Ashortcourse-YaserS.Abu-Mosta
- toolbar+recyclerView+SwipeRefreshLayout+上拉刷
- 基于AES和SHA的文件加密系统本科毕业
- R语言Shiny官方教程中文版
- siggraph2010_vlachos_waterflow
- libpsd v1.0
- Linux.Firewalls.[Michael Rash][En]
- LEDshowtw2010
- TL_81000_English_2018.03.pdf
- 北京矢量地图SHP
- SharpGL测试范例
- TI CMOS毫米波雷达芯片datesheet awr1443
- 基于LSH索引的图像搜索的ppt
- 20个Flash源文件. flash源文件。swf源文件
- 酒店管理系统ssh框架
- SwipeRefreshLayoutDemo
- Long Short Term Memory Networks for Anomaly De
- openwrt-15.05-x86-generic-combined-squashfs.vm
- JFlash Lite v4.85a
- Samsung Toggle Mode DDR NAND Specification
评论
共有 条评论