0

I wrote a Spring MVC 3.1.1 controller to do stuff then return showing "Done".

My controller:

@Controller
public class HomeController {

    @RequestMapping(value = {"/"}, method = RequestMethod.GET)
    public String home(Model model) {
        return "home";
    }

    @RequestMapping(value = {"/dostuff"}, method = RequestMethod.GET)
    public String doStuff(ModelMap model) {
        doStuff();
        model.addAttribute("message", "Done");
        return "redirect:/";
    }
}

My home.jsp:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html><body>

${message}

</body></html>

PROBLEM: When I load http://localhost/myapp/dostuff the page does not show "Done", it is just empty. Also, the URL becomes http://localhost/myapp/?message=Done instead of going back to a clean http://localhost/myapp/. What did I do wrong?

Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
  • http://stackoverflow.com/questions/7429649/how-to-pass-model-attributes-from-one-spring-mvc-controller-to-another-controlle – Blank Aug 10 '16 at 07:37
  • @JPG: The question you linked to is called "*How to pass model attributes from one Spring MVC controller to another controller*" and is unrelated to mine. I only have one controller. – Nicolas Raoul Aug 10 '16 at 07:53

0 Answers0