Announcement Announcement Module
Collapse
No announcement yet.
there is a question to ask . "spring mvc" Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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("bController.do"),mymodel);
    and some objects were put into mymodel,Would you tell me how to get the value of mymodel from bController??????

  • #2
    Hi,
    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

    Comment

    Working...
    X