Announcement Announcement Module
No announcement yet.
there is a question to ask . "spring mvc" Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • there is a question to ask . "spring mvc"

    There is a question to ask when i write an program of web application baseing springmvc.
    the founction Onsubmit of the class Acontroller return new ModelAndView(new RedirectView(""),mymodel);
    and some objects were put into mymodel,Would you tell me how to get the value of mymodel from bController??????

  • #2
    because you use a redirect instead of a forward, all request attributes in your
    mymodel Map are encoded in the URL. (key=value pairs).

    You can retrieve them with request.getParameter("key") in your controller.
    If you don't want to encode everything in the URL or if you want to ship complex classes like your JavaBeans you can save them in the session in controller a and retrieve them back in controller b.

    If redirection is not a must, you can of course forward the request from controller a to b. I think InternalResourceView is capable of forwarding requests between controllers.

    HTH, Chris