electiveinfocontroller.java

来自「Spring+hibernate学生在线选课系统」· Java 代码 · 共 88 行

JAVA
88
字号
/*
 * Created on 2006-2-9
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package org.mmxbb.schoolelective.mvc.elective;

import java.util.HashMap;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.mmxbb.schoolelective.model.Electiveinfo;
import org.mmxbb.schoolelective.service.ElectivedetailService;
import org.mmxbb.schoolelective.service.ElectiveinfoService;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

/**
 * @author Administrator
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class ElectiveinfoController extends MultiActionController {

	private ElectiveinfoService electiveinfoService;
	  
  public ElectiveinfoService getElectiveinfoService() {
      return  electiveinfoService;	
  }  

  public void setElectiveinfoService(ElectiveinfoService electiveinfoService){
  	this.electiveinfoService=electiveinfoService;   
  }
  
	private ElectivedetailService electivedetailService;
	  
public ElectivedetailService getElectivedetailService() {
    return  electivedetailService;	
}  

public void setElectivedetailService(ElectivedetailService electivedetailService){
	this.electivedetailService=electivedetailService;   
}

  
  
	public ModelAndView myElectiveHandler(HttpServletRequest request, HttpServletResponse response) throws ServletException {
    	
		Integer user_id=(Integer)request.getSession().getAttribute("id");
		List ls=getElectiveinfoService().getSpecElectiveinfo("from Electiveinfo o where o.userid="+user_id+" order by o.submittime desc");
    	HashMap result_map=new HashMap();
    	result_map.put("electiveList",ls);
    	return new ModelAndView("web/elective/listElective",result_map);
    }
	
	public ModelAndView electiveListHandler(HttpServletRequest request, HttpServletResponse response) throws ServletException {
    	
		
		List ls=getElectiveinfoService().getAllElectiveinfo();
    	HashMap result_map=new HashMap();
    	result_map.put("electiveList",ls);
    	return new ModelAndView("admin/elective/list",result_map);
    }
	
	public ModelAndView detailElectiveHandler(HttpServletRequest request, HttpServletResponse response) throws ServletException {
    	
		String elective_id=(String)request.getParameter("elective_id");
		Electiveinfo oi=getElectiveinfoService().getElectiveinfo(elective_id);
		List ls=getElectivedetailService().getSpec(elective_id);
    	HashMap result_map=new HashMap();
    	result_map.put("electiveinfo",oi);
    	result_map.put("electivedetail",ls);
    	return new ModelAndView("web/elective/detail",result_map);
    }
	public ModelAndView updateElectiveHandler(HttpServletRequest request, HttpServletResponse response) throws ServletException {
		String elective_id=(String)request.getParameter("elective_id");
		Electiveinfo oi=getElectiveinfoService().getElectiveinfo(elective_id);
		getElectiveinfoService().updateElectiveinfo(oi);
		return new ModelAndView("admin/elective/list");
    }
	
}

⌨️ 快捷键说明

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