• 大小: 18KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-19
  • 语言: Java
  • 标签: MVC代码  

资源简介

网站后台MVC管理,运用JSP+servlet+javabean实现商品的分类管理,分类展示,类别编辑,子类添加等

资源截图

代码片段和文件信息

package javabean;
import java.util.HashSet;
import java.util.Set;
import java.sql.*;
import java.util.*;
/**
 * Category entity. @author MyEclipse Persistence Tools
 */

public class Category implements java.io.Serializable {
private Connection con;
private Statement stmt;
private ResultSet rs;
private static final long serialVersionUID = -1254579775389045146L;
private Integer categoryId;
private Category category;
private String categoryName;
private int fid;
private Set childcategories = new HashSet(0);
// private Set products = new HashSet(0);

// Constructors

/** default constructor */
public Category() {
}

/** minimal constructor */
public Category(Integer categoryId String categoryName) {
this.categoryId = categoryId;
this.categoryName = categoryName;
}

/** full constructor */
public Category(Integer categoryId Category category String categoryName
Set categoriesInteger fathercategoryId) {
this.categoryId = categoryId;
this.category = category;
this.categoryName = categoryName;
this.childcategories = categories;
this.fid=fathercategoryId;
// this.products = products;
}

// Property accessors

public int getCategoryId() {
return this.categoryId;
}

public void setfatherId(int categoryId) {
this.fid = categoryId;
}
public int getfatherId() {
return this.fid;
}

public void setCategoryId(Integer categoryId) {
this.categoryId = categoryId;
}
public Category getCategory() {
return this.category;
}

public void setCategory(Category category) {
this.category = category;
}

public String getCategoryName() {
return this.categoryName;
}

public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}

public Set getCategories() {
return this.childcategories;
}

public void setCategories(Set categories) {
this.childcategories = categories;
}

// public Set getProducts() {
// return this.products;
// }
//
// public void setProducts(Set products) {
// this.products = products;
public List getAllCategories(){

List list=new ArrayList();
String sql=“select * from category where fid=‘0‘“;
try{
rs=executeQuery(sql);
while(rs.next()){
Category temp=new Category();
temp.setCategoryId(rs.getInt(1));
temp.setCategoryName(rs.getString(2));

list.add(temp);

}
}catch(Exception e){

System.out.println(e.toString());
}
return list;
}
public Set getChildrenCategories(int fid){
Set set=new HashSet();
String sql=“select * from category where fid=‘“ +fid+ “‘“;
try {
rs=executeQuery(sql);
while(rs.next()){
Category in=new Category();
in.setCategoryId(rs.getInt(1));
in.setCategoryName(rs.getString(2));
set.add(in);
}
} catch (Exception e) {
//

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-06-22 22:00  Category\
     文件         538  2013-06-25 10:21  Category\.classpath
     目录           0  2013-06-22 18:27  Category\.myeclipse\
     文件         297  2013-06-24 13:27  Category\.mymetadata
     文件        1529  2013-06-25 10:21  Category\.project
     目录           0  2013-06-22 22:00  Category\.settings\
     文件         500  2013-06-22 11:48  Category\.settings\.jsdtscope
     文件          49  2013-06-22 11:48  Category\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2013-06-22 11:48  Category\.settings\org.eclipse.wst.jsdt.ui.superType.name
     文件         351  2013-06-25 10:18  Category\.settings\org.eclipse.wst.validation.prefs
     目录           0  2013-06-22 22:00  Category\src\
     目录           0  2013-06-22 22:00  Category\src\javabean\
     文件        5686  2013-06-23 14:54  Category\src\javabean\Category.java
     目录           0  2013-06-22 22:00  Category\src\servlet\
     文件        2943  2013-06-23 15:13  Category\src\servlet\CategoryServlet.java
     目录           0  2013-06-23 13:43  Category\WebRoot\
     文件        1687  2013-06-23 15:15  Category\WebRoot\categorylist.jsp
     文件        2018  2013-06-23 12:39  Category\WebRoot\editcategory.jsp
     目录           0  2013-06-23 00:55  Category\WebRoot\images\
     文件          67  2013-06-23 00:53  Category\WebRoot\images\open_close.gif
     文件         834  2013-06-22 11:48  Category\WebRoot\index.jsp
     目录           0  2013-06-22 22:00  Category\WebRoot\meta-INF\
     文件          36  2013-06-22 11:48  Category\WebRoot\meta-INF\MANIFEST.MF
     文件        1527  2013-06-23 15:11  Category\WebRoot\ShowChildren.jsp
     目录           0  2013-06-22 22:00  Category\WebRoot\WEB-INF\
     文件          54  2013-06-25 10:17  Category\WebRoot\WEB-INF\.faces-config.mex
     目录           0  2013-06-23 12:03  Category\WebRoot\WEB-INF\classes\
     目录           0  2013-06-23 12:03  Category\WebRoot\WEB-INF\classes\javabean\
     文件        7190  2013-06-23 14:54  Category\WebRoot\WEB-INF\classes\javabean\Category.class
     目录           0  2013-06-23 12:03  Category\WebRoot\WEB-INF\classes\servlet\
     文件        3659  2013-06-23 15:13  Category\WebRoot\WEB-INF\classes\servlet\CategoryServlet.class
............此处省略3个文件信息

评论

共有 条评论

相关资源