I have a spring 3.1 web application and I am trying to execute an ajax request, but in firebug I see that my mapping was not found. I tried different things, but can't just get to my controller method. Here are a few details:
I have my my web.xml:
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/ctrl/*</url-pattern>
</servlet-mapping>
this is in my controller:
@RequestMapping(value="/ctrl/test", method = RequestMethod.GET)
public @ResponseBody String test() {
System.out.println("method test()");
return "aString";
}
this is in my manager-servlet.xml:
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/pages/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
I have another request mapped to a method in my controller and that it works, but it is not ajax:
@RequestMapping(value="/ctrl", method = RequestMethod.GET)
public String printWelcome(ModelMap model, HttpSession session) {
initializeTree(session);
return "tree";
}
Can anyone point me in the right direction?
source
share