listcategoryaction.java

来自「基于Struts的网络商店源码。使用Hibernate技术」· Java 代码 · 共 72 行

JAVA
72
字号
package com.sush.webstore.store.web.struts;

import java.util.Set;

import com.sush.webstore.store.domain.ICatalog;
import com.sush.webstore.store.domain.ICategory;
import com.sush.webstore.store.domain.IWebStoreFacade;
import com.sush.webstore.store.domain.facade.WebStorePOJO;

public class ListCategoryAction {

	private IWebStoreFacade webStore = new WebStorePOJO();

	private Set<ICategory> categories;

	private long id;

	public String execute() {

		ICatalog catalog = webStore.getCatalog(id);
		if (catalog == null)
			return "error";
		
		categories = webStore.getCategories(catalog);
		return "success";
	}

	/**
	 * @return the webStore
	 */
	public IWebStoreFacade getWebStore() {
		return webStore;
	}

	/**
	 * @param webStore
	 *            the webStore to set
	 */
	public void setWebStore(IWebStoreFacade webStore) {
		this.webStore = webStore;
	}

	/**
	 * @return the id
	 */
	public long getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(long id) {
		this.id = id;
	}

	/**
	 * @return the categories
	 */
	public Set<ICategory> getCategories() {
		return categories;
	}

	/**
	 * @param categories the categories to set
	 */
	public void setCategories(Set<ICategory> categories) {
		this.categories = categories;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?