In my controller:
@Controller
@RequestMapping(value="Main")
/*the methods */
@RequestMapping(value="/index.do", method = RequestMethod.GET)
In my web.xml:
<servlet-mapping>
<servlet-name>MyController</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>Main/index.do</welcome-file>
</welcome-file-list>
When I type : localhost/projectname/
, it doesn't lead to localhost/projectname/Main/index.do
as I expected, and has nothing output in the console of eclipse.
But if I try the whole URL localhost/projectname/Main/index.do
, the controller is responding with what I want.
So how should I configure my welcome-file-list?
The
<welcome-file-list>
is composed of actual files, not URLs. So you cannot putMain/index.do
in it. What you can do is to put a simple html file that does a redirect toindex.do
something like :The body block should never be evaluated.