0
votes

after getting request from ajax to controller i am not able to move to next page through ModelAndView("/authenticationError.jsp"); controller code

@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 code

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 code -

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

1 Answers

0
votes

You are doing it wrong..You need to write .jsp and can set the view as

 mav.setViewName("list"); 

Basically

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

is shorthand for

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