I'm new to Spring & Request Mapping and I currently have a maven web project setup that doesn't seem to handle my initial request properly
In my web.xml
I have:
<servlet>
<servlet-name>Example</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/Example-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Example</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
And my Example-servlet.xml
:
<context:component-scan base-package="com.example.controller" /> //right package
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/pages/" />
<property name="suffix" value=".jsp" />
</bean>
And lastly my ExampleController
:
@Controller
@RequestMapping("/")
public class ExampleController {
@RequestMapping(value = "/start")
public String start() {
System.out.println("Example Starting...");
}
}
My example
directory structure:
however when I navigate to localhost:8080/example/ my page loses all of it's CSS styling and pretty much all calls to other files in the project. I get the Warning
No mapping found for HTTP request with URI [/example/css/main.css] in DispatcherServlet with name 'Example'
And a bunch of other warnings/404's for files I'm not trying to map.
Could someone help me understand exactly where my project is misconfigured?