I have very basic setup for a spring mvc web application. Here is my web.xml mapping below:
<servlet>
<servlet-name>test</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:spring-config.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
and spring-config.xml
<mvc:default-servlet-handler/>
<mvc:annotation-driven />
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/pages/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<context:component-scan base-package="cz.dmostek"/>
<context:annotation-config/>
and this is my directory structure for the jsp pages
`-- web
`-- WEB-INF
|-- pages
| |-- css
| | |-- foundation.css
| | `-- normalize.css
| |-- images
| |-- index.jsp
| `-- js
`-- web.xml
and my controller is declared below:
@Controller
public class TestController {
@RequestMapping(value = "/")
public String
return "index";
}
}
However, when i try to access localhost:8080/app/ I got 404 error. In the log I have 2013-10-19 16:12:09,326 () DEBUG DispatcherServlet - Successfully completed request
and if i debug the app everything seems ok, controller is called, view is rendered, but i am still getting 404. What do you think?