Still trying to wrap my head around using the Spring Framework so I apologize in advance for my shiny newness.
I am trying to get Ajax to work and am having less than stellar results.
Here is the controller code, which is just something I'm trying to get to work so it may seem trivial:
@RequestMapping("/rest/login")
public @ResponseBody CallManager logIn() throws ServletException {
callManager.removeStationId();
return callManager;
}
Here is the relevant 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>*.htm</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>myservlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
And here is the myservlet-servlet.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<import resource="database-c3p0.xml" />
<context:annotation-config/>
<mvc:annotation-driven />
<!-- the application context definition for the springapp DispatcherServlet -->
<bean id="productManager" class="org.dat.service.ProductManagerImpl">
</bean>
<bean id="priceIncrease" class="org.dat.service.PriceIncrease">
</bean>
<bean id="stationID" class="org.dat.domain.StationId">
<property name="datStation" value=""/>
</bean>
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="messages"/>
</bean>
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView">
</property>
<property name="prefix" value="/WEB-INF/jsp/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
</beans>
This is the error I am getting:
org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/myservlet/rest/login] in DispatcherServlet with name 'myservlet'
Any help you can provide getting Ajax properly running is greatly appreciated. Please let me know if you need to see anything else. Thank you.