tags:

views:

17

answers:

1

Hi All,

I have a JSP page called CreateProcessGroup.jsp and i use an annotation controller to map requests to CreateProcessGroup.htm to that page. But i m having an interesting issue when i request the page from browser it works, when send a request using jquery $.get method i get 404 (CreateProcessGroup.htm not found) is there a difference between two requests?

My jsp page just under WebContent dir and js file under WEBContent/Jquery my function sending the request like below:

function SendCreateProcessGroupRequest()
{
var pid = $('#pid').val();
var description = $('#processGroupDescription').val();

var x = "/CreateProcessGroup.htm";
alert(x);

$.get(x, { pid: 62, description: description },
           function(data){
             alert("Data Loaded: " + data);
           });
}

Do i need to give the url as ../CreateProcessGroup.htm ? Indeed i tried /CreateProcessGroup.htm ../CreateProcessGroup.htm /../CreateProcessGroup.htm ../../CreateProcessGroup.htm /../../CreateProcessGroup.htm

My guess is DispatcherServlet can not map Ajax requests to Controllers but this is stupid isn't it?

How can i get rid of the situation?

Thanks all.

A: 

Try this instead:

var x = "CreateProcessGroup.htm";

If the page you're requesting is beside the one making the request there's no need for a path in front, it will (by default) make a request to the same path just with that page/handler on the end.

Nick Craver