从ajax获取请求到控制器后,我无法通过ModelAndView移动到下一页(" /authenticationError.jsp"); 控制器代码
@RequestMapping(value =" / ProcessReject,method = 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 :(得分:0)
你做得错了。你需要写.jsp
并将视图设置为
mav.setViewName("list");
基本上
new ModelAndView("welcomePage", "WelcomeMessage", message);
是
的简写ModelAndView mav = new ModelAndView();
mav.setViewName("welcomePage");
mav.addObject("WelcomeMessage", message);