My ajax request is not being processed. I receive the warning when starting my server : WARNING: No mapping found for HTTP request with URI [/jquery-1.7.js] in DispatcherServlet with name 'dispatcher'. I think this is occuring because the file jquery-1.7.js is not being found.
<jsp:useBean id="message" scope="request" type="java.lang.String"/>
<html>
<head>
<title>Spring MVC Ajax Demo</title>
<script type="text/javascript" src="./jquery-1.7.js"></script>
<script type="text/javascript">
function doAjax() {
alert('here')
$.ajax({
url: 'time',
data: ({name : "me"}),
success: function(data) {
$('#time').html(data);
}
});
}
</script>
</head>
<body>
${message}
<button id="demo" onclick="doAjax()" title="Button">Get the time!</button>
<div id="time">
</div>
</body>
</html>
Do I need to amend the dispatcher entry -
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Update - this helped me : Static files in (Java) App Engine not accessible