The problem was that that something Tomcat? When I removed that, the request did not get forwarded anymore. What I did to diagnose the problem was to make a catch-all request handler and printed the servlet path to the console. The redirect is one option. One thing you can try is to create a very simple index page that you place at the root of the WAR which does nothing else but redirecting to your controller like.
We can simply map a Controller method for the default view. For eg, we have a index. I know these are no great differences, but I'm pretty sure I'm not at work now this is my configuration and it works with Spring MVC 3.
One more thing. You don't show your dispatcher configuration in web. It has to be something like this:.
EDIT: Answering your question, my view resolver configuration is a little different too:. After that use any controllers that your want to process index. Or just use index controller. After putting this to your xml put your default view or jsp file in your custom JSP folder as you have mentioned in mvc-dispatcher-servlet. One way to achieve it, is by map your welcome-file to your controller request path in the web.
Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Spring MVC: how to create a default controller for index page?
Ask Question. Asked 10 years, 10 months ago. Active 5 years, 2 months ago. Viewed k times. My web. To map your form action request o its controller i. HelloController , create [serlvlet-name]-servlet. Make sure you have used the same name that you have used the front controller in the web. Download Source Code: springmvc-hello-world-using-xml-configuration. Find centralized, trusted content and collaborate around the technologies you use most.
Connect and share knowledge within a single location that is structured and easy to search. What you can do is to put a simple html file that does a redirect to index. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 7 years, 7 months ago.
Active 7 years, 7 months ago. Viewed 2k times. GET In my web.
0コメント