2015-10-10 36 views
0

从ajax获取请求到控制器后,我无法通过ModelAndView(“/ authenticationError.jsp”)移动到下一页。 控制器代码ModelAndView(“/ authenticationError”);不工作

@RequestMapping(值= “/ ProcessReject,方法= RequestMethod.POST”)

public ModelAndView Reject(@RequestParam(value = "StatusComments") String StatusComments, 
     @RequestParam(value = "ruleIndex") String ruleIndex, 
     @RequestParam(value = "country") String country, 
     HttpSession session) throws Exception { 
ModelAndView mav ; 
System.out.println("StatusComments "+ StatusComments); 
System.out.println("ruleIndex "+ ruleIndex); 
System.out.println("country "+ country); 
String quicklookid = (String) session.getAttribute("quicklookid"); 

//rejectRuleBusinessLogic.reject(ruleIndex, country, quicklookid, StatusComments); 

mav = new ModelAndView("/authenticationError.jsp"); 
return mav; 

Ajax代码

function showRejectStatusMsg(value1, value2) 
{ 

       $.ajax({ 
        type: "POST", 
        cache: false, 
        url: "ProcessViewRule.ncr", 
        data:"ruleIndex=" +value1 +"&country="+value2, 

       success: function(response) { 
       }, 
       error : function(e) { 
        alert('Error in response...' + e); 
       } 


       }); 

jsp代码 -

<a href="javascript:showRejectStatusMsg(<c:out value='${List.ruleindex}'/>, '<c:out value="${List.country}"/>')" id="rejectLink" class="navlink" >Reject</a>)) 

回答

0

您做错了..你需要写.jsp,并可以设置视图小号

mav.setViewName("list"); 

基本上

new ModelAndView("welcomePage", "WelcomeMessage", message); 

ModelAndView mav = new ModelAndView(); 
mav.setViewName("welcomePage"); 
mav.addObject("WelcomeMessage", message); 
速记