资源简介
基于SSH的网上书城项目
代码片段和文件信息
package com.bookshop.action;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.bookshop.entity.*;
import com.opensymphony.xwork2.ActionContext;
import com.bookshop.DAO.*;
@Controller @Scope(“prototype“)
public class BookAction {
@Resource BookDAO bookservice;
private Book book;
public Book getBook(){
return book;
}
public void setBook(Book book){
this.book=book;
}
private String name;
private String writer;
private String publish;
private String pubdate;
private String isbn;
private String contents;
private String image;
private String searchname;
public String getSearchname(){
return searchname;
}
public void setSearchname(String searchname){
this.searchname=searchname;
}
private String username;
public String getUsername(){
return username;
}
public void setUsername(String username){
this.username=username;
}
private String price;
public String getPrice() {
return this.price;
}
public void setPrice(String price) {
this.price = price;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getWriter() {
return this.writer;
}
public void setWriter(String writer) {
this.writer = writer;
}
public String getPublish() {
return this.publish;
}
public void setPublish(String publish) {
this.publish = publish;
}
public String getPubdate() {
return this.pubdate;
}
public void setPubdate(String pubdate) {
this.pubdate = pubdate;
}
public String getIsbn() {
return this.isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
public String getContents() {
return this.contents;
}
public void setContents(String contents) {
this.contents = contents;
}
public String getImage() {
return this.image;
}
public void setImage(String image) {
this.image = image;
}
public String add(){
Book book=new Book();
book.setPrice(Integer.parseInt(price));
book.setContents(contents);
book.setImage(image);
book.setIsbn(isbn);
book.setName(name);
book.setPubdate(pubdate);
book.setPublish(publish);
book.setWriter(writer);
bookservice.save(book);
ActionContext context = ActionContext.getContext();
context.getSession().put(“book“ book);
return “add“;
}
public String list(){
List ems = bookservice.list();
ActionContext ac = ActionContext.getContext();
ac.getSession().put(“book“ems);
ac.getSession().put(“username“username);
// for(Book em: ems)
// System.out.println(em.getName()+em.getPublish());
return “list“;
}
public String search(){
System.out.print(“search“+searchname);
Book book=bookservice.find(searchname);
ActionContext context = ActionContext.getContext();
c
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3585 2014-01-01 15:36 book\.classpath
文件 297 2015-05-13 22:05 book\.myme
文件 1751 2013-12-24 15:42 book\.project
文件 500 2013-12-24 15:41 book\.settings\.jsdtscope
文件 364 2013-12-24 15:41 book\.settings\org.eclipse.jdt.core.prefs
文件 462 2013-12-24 15:41 book\.settings\org.eclipse.wst.common.component
文件 252 2013-12-24 15:41 book\.settings\org.eclipse.wst.common.project.facet.core.xm
文件 49 2013-12-24 15:41 book\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 6 2013-12-24 15:41 book\.settings\org.eclipse.wst.jsdt.ui.superType.name
文件 3115 2014-01-02 20:59 book\src\beans.xm
文件 3879 2014-01-03 15:16 book\src\com\bookshop\action\BookAction.java
文件 4792 2014-01-03 11:24 book\src\com\bookshop\action\CartAction.java
文件 2247 2014-01-02 18:41 book\src\com\bookshop\action\UserAction.java
文件 287 2014-01-01 15:58 book\src\com\bookshop\DAO\BookDAO.java
文件 518 2014-01-02 16:42 book\src\com\bookshop\DAO\CartDAO.java
文件 291 2014-01-02 21:41 book\src\com\bookshop\DAO\OrderDAO.java
文件 310 2014-01-01 15:38 book\src\com\bookshop\DAO\UserDAO.java
文件 1204 2014-01-01 15:59 book\src\com\bookshop\DAOservice\BookDAOImpl.java
文件 2253 2014-01-03 00:41 book\src\com\bookshop\DAOservice\CartDAOImpl.java
文件 1220 2014-01-02 21:41 book\src\com\bookshop\DAOservice\OrderDAOImpl.java
文件 1252 2014-01-01 15:39 book\src\com\bookshop\DAOservice\UserDAOImpl.java
文件 1685 2014-01-02 19:44 book\src\com\bookshop\entity\Book.hbm.xm
文件 2270 2014-01-02 19:44 book\src\com\bookshop\entity\Book.java
文件 1287 2014-01-01 15:38 book\src\com\bookshop\entity\Customer.hbm.xm
文件 1473 2014-01-01 15:38 book\src\com\bookshop\entity\Customer.java
文件 1190 2014-01-02 21:14 book\src\com\bookshop\entity\Orders.hbm.xm
文件 1434 2014-01-02 20:56 book\src\com\bookshop\entity\Orders.java
文件 1362 2014-01-02 21:51 book\src\com\bookshop\entity\Shoppingcart.hbm.xm
文件 1572 2014-01-02 21:59 book\src\com\bookshop\entity\Shoppingcart.java
文件 1665 2014-01-03 11:18 book\src\struts.xm
............此处省略97个文件信息
评论
共有 条评论