java - maintain state with spring between requests -
I'm new to spring if this is the first question, but the manual is not clear (at least not for me)
My question is: How do I share the state between requests in spring? I can send data from the controller using ModelMap, but the Data View is not sent back to the next controller by ModelMap. How can I do this with spring?
Below is a part of my source code. Modelmap in the second controller does not have data stored in the modelmap of the first controller. I
@RequestMapping (value = "find / some", method = requested method. How do I state between the controllers in the spring Is it considered to be retained? GET) Public string foo (@RequestParam ("parent") parent parent, ModelMap modelMap) {... modelMap.addAttribute ("question_index", 42); ModelMap.addAttribute ("Something", something new ()); ModelMap.addAttribute ("data", new data ()); Return "see / see"; } & Lt; Form: form action = "bla" method = "POST" modelAttribute = "data" & gt; ... // Using some () and 42 & lt; / Form: form & gt; @RequestMapping (value = "bla", method = RequestMethod.POST) Public String Blay (@ModelAttribute ("data") data data, binding result result, ModelMap modelMap) {System.out.println (modelMap); // in question_index, or nothing)
Enter either model Use HttpSession
, or (better for large applications), where you can do so-called conversations.
Comments
Post a Comment