package com.action;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;
import com.bean.Caigou;
import com.bean.Wuliao;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.service.CaigouService;
import com.util.PageModel;
public class CaigouAction extends ActionSupport {
	private Caigou caigou;
	private CaigouService caigouService;
	
	public String save() throws Exception {
		this.caigouService.save(caigou);
		return "sud";
	}
	public String show() throws Exception {
		int offset=0;
        HttpServletRequest request = ServletActionContext.getRequest();
        try {   
            offset = Integer.parseInt(request.getParameter("pager.offset"));  
         } catch (Exception e) {   
         }  
         if(offset<0) {
        	 offset = 0;
         }
         //这里我按照每页显示15条   
         PageModel pm=this.caigouService.findall(offset);
         ActionContext.getContext().put("pm", pm);
		return "show";
	}
	public String showone() throws Exception {
		caigou=this.caigouService.findById(caigou.getId());
		ActionContext.getContext().put("caigou",caigou);
		return "showone";
	}
	public String showone1() throws Exception {
		caigou=this.caigouService.findById(caigou.getId());
		ActionContext.getContext().put("caigou",caigou);
		return "showone1";
	}
	public String update() throws Exception {
		this.caigouService.update(caigou);
		return "sud";
	}
	public String delete() throws Exception {
		Caigou caigou1=this.caigouService.findById(caigou.getId());
		this.caigouService.delete(caigou1);
		return "sud";
	}
	
	
	public Caigou getCaigou() {
		return caigou;
	}
	public void setCaigou(Caigou caigou) {
		this.caigou = caigou;
	}
	public CaigouService getCaigouService() {
		return caigouService;
	}
	public void setCaigouService(CaigouService caigouService) {
		this.caigouService = caigouService;
	}
}
 最近下载更多
最近下载更多
                
                weilaizhisheng     LV21
                2023年11月30日
            
            
        
                testuser1234567     LV24
                2022年6月15日
            
            
        
                wanglinddad     LV55
                2022年4月22日
            
            
        
                877549024     LV8
                2022年4月21日
            
            
        
                葡萄树下酒庄     LV9
                2022年1月5日
            
            
        
                没有鱼     LV3
                2021年8月17日
            
            
        
                Rains_     LV9
                2020年10月30日
            
            
        
                haitao793     LV3
                2020年7月7日
            
            
        
                1057706707     LV9
                2020年6月14日
            
            
        
                dqsy520     LV4
                2020年6月12日
            
            
        
 
                 
                 
     最近浏览
最近浏览