-1
@RequestMapping("/test/index")
public String index(ModelMap map<----, @PathVariable(value = "language") String language,
        @PathVariable(value = "test") String test, HttpServletRequest request, HttpServletResponse response,
        HttpSession session) {
.......
}


public void updateView() {
   map.put("key",value);                                
   updateview();
}

I want to access and update view in other method,but how to use the ModelMap as global variable?And how to update the view after map.put()?

Satz
  • 307
  • 3
  • 19
tensor
  • 43
  • 2
  • Possible duplicate of [Spring MVC - How to get all request params in a map in Spring controller?](https://stackoverflow.com/questions/7312436/spring-mvc-how-to-get-all-request-params-in-a-map-in-spring-controller) – Ashish Ratan Mar 26 '18 at 06:30
  • By Using RedirectAttributes, see the below link [enter link description here](https://stackoverflow.com/questions/49122495/how-to-pass-model-data-from-one-controller-to-another-controller-spring/49123201#49123201) – balu Mar 26 '18 at 06:54

1 Answers1

-1

As per your current question and given program, i am giving my answer.

  1. Create Class level variable for ModelMap
  2. Then, generate getter and setter for the same.
  3. Now, you can utilize that object where you want.

I hope this answer will give you an idea.

Satz
  • 307
  • 3
  • 19