资源简介

图书推荐系统-书趣

资源截图

代码片段和文件信息

package com.shuqu.action;

import java.util.List;

import net.sf.json.JSONobject;

import com.opensymphony.xwork2.ModelDriven;
import com.shuqu.domain.Book;
import com.shuqu.domain.Goods;
import com.shuqu.domain.Library;
import com.shuqu.domain.User;
import com.shuqu.bean.BookPageBean;
import com.shuqu.service.BookService;

/**
 * 书籍信息Action类
 * @author 汪文博
 *
 */
public class BookAction extends SuperAction implements ModelDriven{

private static final long serialVersionUID = 1L;

private BookService bookService;        //自动注入业务类
private Book book = new Book();

private int page;        //当前页

private String classify;      //按书籍分类获取书籍信息的分类名

private int orderSort;        //排序种类

private String searchCon;     //普通检索关键词

private int searchSort;       //普通检索种类

/**
 * 实现模型驱动
 */
public Book getModel(){
return book;
}

public void setBookService(BookService bookService){
this.bookService = bookService;
}

public int getPage() {
return page;
}

public void setPage(int page) {
this.page = page;
}

public String getClassify() {
return classify;
}

public void setClassify(String classify) {
this.classify = classify;
}

public int getOrderSort() {
return orderSort;
}

public void setOrderSort(int orderSort) {
this.orderSort = orderSort;
}

public String getSearchCon() {
return searchCon;
}

public void setSearchCon(String searchCon) {
this.searchCon = searchCon;
}

public int getSearchSort() {
return searchSort;
}

public void setSearchSort(int searchSort) {
this.searchSort = searchSort;
}


/**
 * 管理员上传书籍操作
 * @return 结果字符串
 */
public String upload(){
//设置文件上传地址
String root = application.getRealPath(“/bookPic“);
//设置文件上传路径
book.setPath(root + “/“ + book.getPicFileName());

System.out.println(“上传图片名称:“+ book.getPicFileName());
System.out.println(“上传图片类型:“+ book.getPicContentType());

//设置新路径
String newPath = “bookPic“ + “/“ + book.getPicFileName();

if(bookService.upload(book.getPic() book.getPicFileName() root newPath 
book.getBookName() book.getBookAuthor() book.getBookTime() 
book.getBookPub() book.getBookIsbn() book.getBookLib() book.getBookIntro() 
book.getBookCatalog() book.getBookInte())){
System.out.println(“上传成功!“);

//存储路径在request中
 request.setAttribute(“bookPath“ newPath);
 
 return “upload_success“;
}else{
System.out.println(“上传失败!“);

return “upload_failure“;
}

}

/**
 * 晒书房(用户上传书籍)
 * @return 结果字符串
 */
public String userUpload(){
//获取用户对象
User user = (User)session.getAttribute(“user“);

//设置文件上传地址
String root = application.getRealPath(“/bookPic“);
//设置文件上传路径
book.setPath(root + “/“ + book.getPicFileName());

System.out.println(“上传图片名称:“+ book.getPicFileName());
System.out.println(“上传图片类型:“+ book.getPicContentType());

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        4181  2017-09-03 13:08  shuqu\.classpath
     文件         367  2017-08-16 11:48  shuqu\.myhibernatedata
     文件        1538  2017-08-31 17:52  shuqu\.project
     目录           0  2018-03-08 19:16  shuqu\.settings\
     文件         522  2017-08-16 11:45  shuqu\.settings\.jsdtscope
     文件         145  2017-08-16 11:48  shuqu\.settings\com.genuitec.runtime.libraries.xml
     文件         364  2017-08-16 11:44  shuqu\.settings\org.eclipse.jdt.core.prefs
     文件         474  2017-08-16 11:45  shuqu\.settings\org.eclipse.wst.common.component
     文件         617  2017-08-16 11:46  shuqu\.settings\org.eclipse.wst.common.project.facet.core.prefs.xml
     文件         563  2017-08-16 11:48  shuqu\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2017-08-16 11:45  shuqu\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2017-08-16 11:45  shuqu\.settings\org.eclipse.wst.jsdt.ui.superType.name
     文件         425  2017-08-16 11:47  shuqu\.springBeans
     目录           0  2017-08-16 11:56  shuqu\src\
     文件        5802  2018-01-24 21:57  shuqu\src\applicationContext.xml
     目录           0  2017-08-16 11:56  shuqu\src\com\
     目录           0  2017-10-20 09:13  shuqu\src\com\shuqu\
     目录           0  2017-09-27 17:54  shuqu\src\com\shuqu\action\
     文件       10565  2018-03-08 20:04  shuqu\src\com\shuqu\action\BookAction.java
     文件        2458  2018-03-08 23:35  shuqu\src\com\shuqu\action\CollectAction.java
     文件        1530  2018-03-10 14:48  shuqu\src\com\shuqu\action\CommentAction.java
     文件        1999  2018-01-15 17:18  shuqu\src\com\shuqu\action\LibraryAction.java
     文件        1260  2017-08-16 12:08  shuqu\src\com\shuqu\action\SuperAction.java
     文件        5437  2018-03-10 16:02  shuqu\src\com\shuqu\action\TribuneAction.java
     文件        3310  2017-12-02 14:01  shuqu\src\com\shuqu\action\UserAction.java
     目录           0  2018-01-23 17:35  shuqu\src\com\shuqu\bean\
     文件        1915  2017-11-15 15:51  shuqu\src\com\shuqu\bean\BookPageBean.java
     文件        2049  2018-01-27 15:25  shuqu\src\com\shuqu\bean\ClusterBean.java
     文件        1689  2017-09-09 10:03  shuqu\src\com\shuqu\bean\CollectPageBean.java
     文件        4830  2018-03-08 23:01  shuqu\src\com\shuqu\bean\SpiderBean.java
     文件        1695  2017-09-12 09:15  shuqu\src\com\shuqu\bean\TribunePageBean.java
............此处省略366个文件信息

评论

共有 条评论