I am trying to map a couple urls to their respective controllers as follows:
/index.html => HomeController
/login/index.html = LoginController
My mapping bean in my servlet xml looks like this:
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<map>
<entry key="/index.html">
<ref bean="homeController" />
</entry>
<entry key="/login/index.html">
<ref bean="loginController" />
</entry>
</map>
</property>
</bean>
I have properly defined the ref beans for homeController
and loginController
.
I can load the home page properly, but when I try to navigate to /login
, instead of displaying the jsp pointed to by loginController
, I get tomcat requested resource unavailable error. Is there something wrong with my syntax here? Thanks
Heres a portion of my web.xml:
<servlet>
<servlet-name>myServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>myServlet</servlet-name>
<url-pattern>/index.html</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>