这个controler不执行

package com.mvc.controller;

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

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

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.mvc.entity.BULLETINS;
import com.mvc.entity.Recoder;
import com.mvc.service.RecoderService;


@Controller
@RequestMapping("/bulletins.do")
public class RecoderController {
	protected final transient Log log = LogFactory
	.getLog(RecoderController.class);
	@Autowired
	private RecoderService recoderService;
	public RecoderController(){	
	}
	
	@RequestMapping
	public String load(ModelMap modelMap){
		List<Object> list = recoderService.getStudentList();
		modelMap.put("list", list);
		return "bulletins";
	}
	
	@RequestMapping(params = "method=add")
	public String add(HttpServletRequest request, ModelMap modelMap) throws Exception{
		return "student_add";
	}
	
	@RequestMapping(params = "method=save")
	public String save(HttpServletRequest request, ModelMap modelMap){
		String user = request.getParameter("user");
		String psw = request.getParameter("psw");
		Recoder rc = new Recoder();
//		rc..setUser(user);
//		rc.setPsw(psw);
		try{
		//	recoderService.save(rc);
			modelMap.put("addstate", "添加成功");
		}
		catch(Exception e){
			log.error(e.getMessage());
			modelMap.put("addstate", "添加失败");
		}
		
		return "student_add";
	}
	

	//没有类级别的@RequestMapping,访问此方法的url为“/hello”
//    @RequestMapping(value="/bullConent")
//    public ModelAndView hello(){
//        ModelAndView mv = new ModelAndView();
//        mv.addObject("message", "hello");
//        mv.setViewName("bullConent");
//        return mv;
//    }       , method = {RequestMethod.GET}
    
//	@RequestMapping(value="/detail")
//	public ModelAndView detail(@RequestParam("id") String id, HttpServletResponse response){
//	    
//	    ModelAndView modelAndView = new ModelAndView();  
//	    modelAndView.addObject("id", BU);  
//	    modelAndView.setViewName("bulldetail");  
//	    return modelAndView;
//	}
	
	
	@RequestMapping("/detail.do")
	public String detail(@RequestParam("id") String id,  Map<String, Object> map){

		try{
			  map.put("BULLETINS", recoderService.getBULLETINS(Integer.valueOf(id))); 
//			  public String find2UserById(User user,ModelMap modelMap){
//			       modelMap.put("user", user);
//		       return"/user";
					
		}
		catch(Exception e){
			log.error(e.getMessage());
			e.printStackTrace();
		}
		return "bulldetail";
	}
	
	
	@RequestMapping(params = "method=del")
	public void del(@RequestParam("id") String id, HttpServletResponse response){
		try{
			Recoder rc = new Recoder();
			rc.setId(Integer.valueOf(id));
			//recoderService.delete(rc);
			response.getWriter().print("{\"del\":\"true\"}");
		}
		catch(Exception e){
			log.error(e.getMessage());
			e.printStackTrace();
		}
	}
}

 

你可能感兴趣的:(这个controler不执行)