由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Spring MVC question.
相关主题
spring question入门问题:以Spring+JPA开发back end,那么表现层只能用jsp吗?
大牛能不能通俗易懂的说说springservlet到底是啥玩意
question on struts (HELP!)已经学完jsp and servlet了,下一步是不是该学struts了
j2ee现在流行什么?Spring question, redirect and carry data over?
web application请教一个关于GWT的问题
struts vs Spring MVC ??spring mvc 里面 view 必须是 jsp吗?
怎么快速掌握Struts?tomcat 访问硬盘文件的问题, 3x
谁能给我推荐一个strutsspringhibernate的项目J2EE和未来工作问题
相关话题的讨论汇总
话题: spring话题: mvc话题: do话题: jsp话题: question
进入Java版参与讨论
1 (共1页)
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.

1 (共1页)
进入Java版参与讨论
相关主题
J2EE和未来工作问题web application请教
interview求助struts vs Spring MVC ??
JSF有前途吗怎么快速掌握Struts?
How to prevent double submission in web form?谁能给我推荐一个strutsspringhibernate的项目
spring question入门问题:以Spring+JPA开发back end,那么表现层只能用jsp吗?
大牛能不能通俗易懂的说说springservlet到底是啥玩意
question on struts (HELP!)已经学完jsp and servlet了,下一步是不是该学struts了
j2ee现在流行什么?Spring question, redirect and carry data over?
相关话题的讨论汇总
话题: spring话题: mvc话题: do话题: jsp话题: question