⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newsaction.java

📁 结合WebWork+Spring+Hibernate
💻 JAVA
字号:
package news.wzt.action;

import java.util.List;
import java.util.Map;

import news.wzt.Service.ICatalogService;
import news.wzt.Service.INewsService;

import com.opensymphony.xwork.ActionContext;
import com.opensymphony.xwork.ActionSupport;

@SuppressWarnings("serial")
public class NewsAction extends ActionSupport {

	private ICatalogService catalogService;
	private INewsService newsService;
	private Integer catalogid;

	public Integer getCatalogid() {
		return catalogid;
	}

	public void setCatalogid(Integer catalogid) {
		this.catalogid = catalogid;
	}

	public ICatalogService getCatalogService() {
		return catalogService;
	}

	public void setCatalogService(ICatalogService catalogService) {
		this.catalogService = catalogService;
	}
	
	public INewsService getNewsService() {
		return newsService;
	}

	public void setNewsService(INewsService newsService) {
		this.newsService = newsService;
	}
	
	@SuppressWarnings("unchecked")
	public String browseCatalog() throws Exception{
		
		List catalogs=catalogService.getAllCatalogs();
		Map request=(Map)ActionContext.getContext().get("request");
		request.put("catalogs",catalogs);
		return SUCCESS;		
	}
	
	@SuppressWarnings("unchecked")
	public String browseNews() throws Exception{
		
		List news=newsService.getNewsByCatalogid(catalogid);
		Map request=(Map)ActionContext.getContext().get("request");
		request.put("news", news);
		return SUCCESS;
	}
	
}

⌨️ 快捷键说明

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