searchcourseinfoformcontroller.java

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

JAVA
72
字号
/*
 * Created on 2005-10-15
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package org.mmxbb.schoolelective.mvc.course;


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

import javax.servlet.ServletException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.ModelAndView;



import org.mmxbb.schoolelective.model.Courseinfo;
import org.mmxbb.schoolelective.service.CategoryService;



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

	   private CategoryService categoryService;
	    
	    public void setCategoryService(CategoryService categoryService){
	        this.categoryService = categoryService;
	    }
	    
	    public CategoryService getCategoryService(){
	        return this.categoryService;
	    }    
	    protected static Log log = LogFactory.getLog(AddCourseinfoFormController.class);
	    
	    public SearchCourseinfoFormController() {
			// OK to start with a blank command object
			setCommandClass(Courseinfo.class);
			// activate session form mode to allow for detection of duplicate submissions
			setSessionForm(true);
		}

		protected ModelAndView onSubmit(Object command) throws ServletException {
		    log.info("onSubmit is called");
		    
		    Courseinfo obj =(Courseinfo)command;
		    List courselist=getCourseinfoService().findSpecCourse(obj);
		    Integer count=new Integer(courselist.size());
	        Map result=new HashMap();
		    result.put("courseList",courselist);
		    result.put("count",count);
			return new ModelAndView("web/search/searchResult",result);
		    
		}
		
	
	
		
		
	
}

⌨️ 快捷键说明

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