Use redirection to prevent refresh requests twice when using springMvc

Use redirection to prevent refresh requests twice when using springMvc

 

 

 

 @RequestMapping(value = "/settlementNo")

 public String settlementNo(Model model,Integer orderId,RedirectAttributes redirecatttr){//Used to receive redirection parameters

 

 

                             redirecatttr.addAttribute("OrderTypeStatus", 4);//Use this to pass parameters to the redirection method, the general page uses model

return "redirect:/myorder/tomyPurchase.do";//Connect the url, in this way, the browser address can be changed, and the customer prevents the refresh from requesting the modification operation again

//return "/offer/member/myPurchase"; page path // cannot change the browser address

 }

  @RequestMapping(value = "/tomyPurchase")

 public String toMyPurchase(Model model,String OrderTypeStatus){

 if(OrderTypeStatus.equals("1")){

 model.addAttribute("OrderTypeStatus", 1);//To be confirmed

 }else if(OrderTypeStatus.equals("2")){

 model.addAttribute("OrderTypeStatus", 2);//To be paid

 }else if(OrderTypeStatus.equals("3")){

 model.addAttribute("OrderTypeStatus", 3);//To be released

 }else if(OrderTypeStatus.equals("4")){

 model.addAttribute("OrderTypeStatus", 4);//To be settled

 }else if(OrderTypeStatus.equals("5")){

 model.addAttribute("OrderTypeStatus", 5);//Completed

 }else{

 model.addAttribute("OrderTypeStatus", 0);//Load all

 }

 return "/offer/member/myPurchase";

 }

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326261093&siteId=291194637