g*****g 发帖数: 34805 | 1 Used to use Struts, and here's a question for Spring MVC.
After submit a form successfully, I want to return to
main menu which should be a link like main.html (map .html to spring
controllers).
Now the question is, with InternalResourceViewResolver as ViewResolver,
prefix and suffix specified, /WEB-INF/jsp/ and .jsp respective,
how do you do the redirect?
Do I have to write a dummy jsp page which forwards to main.html? | m******t 发帖数: 2416 | 2 At the end of your form controller, return "redirect:action-name" for the
view name. Replace "action-name" with the action name to enter your main
page. | g*****g 发帖数: 34805 | 3 cool, but what's the best practice?
If I need to do this "redirect:/main.html" in many controller,
isn't that kind of hard coding. Any convenient way to inject
a view or something and if I have to change main controller url, I change it
in xml file for only once.
【在 m******t 的大作中提到】 : At the end of your form controller, return "redirect:action-name" for the : view name. Replace "action-name" with the action name to enter your main : page.
| m******t 发帖数: 2416 | 4
it
I suppose you could do something like this:
Then in every controller where you need to go back to the main page
afterwards:
【在 g*****g 的大作中提到】 : cool, but what's the best practice? : If I need to do this "redirect:/main.html" in many controller, : isn't that kind of hard coding. Any convenient way to inject : a view or something and if I have to change main controller url, I change it : in xml file for only once.
|
|