Spring MVC3 with dojoGrid and xhrGet
I am trying to display search results in a Spring MVC 3 app using dojogrid ((this is my first experience using dojo)) and I am not sure if I am doing the correct way. 

Apologize for the very long description about the issue. Listed below are the two requirements.

1. User clicks a link (sample below) that displays list of members for a customer in a data grid. 

        http://localhost:8080/SampleApp/members?customerId=abc

2. In the page generated in previous request, there is a text box to filter the members that are displayed. Based on the user input in the text box, I have to further filter the members for the customer selected in previous request. I have to do another database call as I might not have retrieved all the members in the first request.


I am able to get back search results (requirement 1). But, for requirement 2, I am not able to submit the get request successfully submitted. 

This is how the flow is currently designed.

1. User clicks on a link (listed below) to bring results for a particular customer 

        (http://localhost:8080/SampleApp/members?customerId=abc)

2. The request in step 1 is handled by a Spring controller 

        (@RequestMapping(value="/members", method = RequestMethod.GET))
   This controller stores the customerId in session and request is then redirected to a jsp (members.jsp)
   
3. members.jsp has a dojoGrid which constructs query 

        <div	dojoType="dojox.data.JsonRestStore"
		jsId="store2"
		id="store2"
		target="<c:url value='members' />">
        </div>

        <div 	dojoType="dojox.grid.DataGrid"
		id="grid2" 
		jsid="grid2"
		store="store2"
		query="{ 
		searchCriteria:'<%= request.getParameter("searchBy") %>',
		customerIdentifier:'<%= request.getParameter("customerId") %>'
		}"
		rowsPerPage="1000"
		autoWidth="true"
		structure="subscriberGridLayout"
	    autoHeight="true"
	    selectionMode="single"
	    selectable="true"
	    errorMessage="Error loading data"
		noDataMessage="<span class='dojoxGridNoData'>No results found.</span>"
		>
        </div>

4. The request initated by the dojogrid is handled by below listed url

        @RequestMapping(value="/members", params={"customerIdentifier","searchCriteria", "!sort"}, method=RequestMethod.GET, headers="Accept=application/json")

5. I am able to get back search results. customerId is currently hardcoded in the url and searchBy param is null (Requirement 1 is done)

6. For requirement 2, I am trying to do a dojo xhrGet to filter search results based on the input entered by user in a text box.

The request (sample url listed below),

        http://localhost:8080/SampleApp/members?customerId=091300036&searchBy=ci

works fine when I paste it in a browser address bar. However, when invoked via xhrGET, I dont see any response and it is not contacting the controller.

In FireBug, I see the same request in both cases.

        GET http://localhost:8080/SampleApp/members?customerId=091300036&searchBy=ci 200 OK 

However, the response in the successful case (via browser) is a JSON object, whereas in the dojo request case, the response contains my entire jsp source code.

Here's the relvant js/jsp code

	
	<input id="searchName" >
		<button dojoType="dijit.form.Button" type="submit" onclick=searchSubscribers()>
	            	Search
	</button> 
	
	
			 dojo.ready(function(){
	            var textbox = new dijit.form.TextBox({
	            	value: "Search By Name or Email",
	            	onFocus: function(){ 
	            		var ph = dijit.byId("searchName");
	            		ph.attr("value",""); },
	                placeHolder: "Search By Name or Email"
	            }, "searchName");
	            textbox.startup();
	            
			});
	
		
	
			function searchSubscribers() {
				var searchCriteria = dijit.byId("searchName").value;
				console.log('searchCriteria --> ' + searchCriteria);
				dojo.xhrGet({
	    		    // The URL of the request
	    		    url: "http://localhost:8080/SubscriberManagement/subscribers?searchBy=" + searchCriteria ,
	    		    handleAs: "json",
	    		    headers : {
	    		    	"Content-Type" : "application/json"
					},  
	    		    load: function(data, ioargs) {
	    		    	console.log("GET was successful with data " + data);
	    		        
	    		    },
	    		    // The error handler
	    		    error: function(error, ioargs) {
	    		    	console.log("GET failed with error " + error);
	    		        alert(error);
	    		    }
    		});

Can someone help me if I am proceeding in the correct way. I was expecting to mimic the first request so that I can display the grid again. But, the response now appears to be the entire jsp source.
Spring MVC3 with dojoGrid and xhrGet
===

I am trying to display search results in a Spring MVC 3 app using dojogrid ((this is my first experience using dojo)) and I am not sure if I am doing the correct way. 

Apologize for the very long description about the issue. Listed below are the two requirements.

1. User clicks a link (sample below) that displays list of members for a customer in a data grid. 

        http://localhost:8080/SampleApp/members?customerId=abc

2. In the page generated in previous request, there is a text box to filter the members that are displayed. Based on the user input in the text box, I have to further filter the members for the customer selected in previous request. I have to do another database call as I might not have retrieved all the members in the first request.


I am able to get back search results (requirement 1). But, for requirement 2, I am not able to submit the get request successfully submitted. 

This is how the flow is currently designed.

1. User clicks on a link (listed below) to bring results for a particular customer 

        (http://localhost:8080/SampleApp/members?customerId=abc)

2. The request in step 1 is handled by a Spring controller 

        (@RequestMapping(value="/members", method = RequestMethod.GET))
   This controller stores the customerId in session and request is then redirected to a jsp (members.jsp)
   
3. members.jsp has a dojoGrid which constructs query 

        <div	dojoType="dojox.data.JsonRestStore"
		jsId="store2"
		id="store2"
		target="<c:url value='members' />">
        </div>

        <div 	dojoType="dojox.grid.DataGrid"
		id="grid2" 
		jsid="grid2"
		store="store2"
		query="{ 
		searchCriteria:'<%= request.getParameter("searchBy") %>',
		customerIdentifier:'<%= request.getParameter("customerId") %>'
		}"
		rowsPerPage="1000"
		autoWidth="true"
		structure="subscriberGridLayout"
	    autoHeight="true"
	    selectionMode="single"
	    selectable="true"
	    errorMessage="Error loading data"
		noDataMessage="<span class='dojoxGridNoData'>No results found.</span>"
		>
        </div>

4. The request initated by the dojogrid is handled by below listed url

        @RequestMapping(value="/members", params={"customerIdentifier","searchCriteria", "!sort"}, method=RequestMethod.GET, headers="Accept=application/json")

5. I am able to get back search results. customerId is currently hardcoded in the url and searchBy param is null (Requirement 1 is done)

6. For requirement 2, I am trying to do a dojo xhrGet to filter search results based on the input entered by user in a text box.

The request (sample url listed below),

        http://localhost:8080/SampleApp/members?customerId=091300036&searchBy=ci

works fine when I paste it in a browser address bar. However, when invoked via xhrGET, I dont see any response and it is not contacting the controller.

In FireBug, I see the same request in both cases.

        GET http://localhost:8080/SampleApp/members?customerId=091300036&searchBy=ci 200 OK 

However, the response in the successful case (via browser) is a JSON object, whereas in the dojo request case, the response contains my entire jsp source code.

Here's the relvant js/jsp code

	
	<input id="searchName" >
		<button dojoType="dijit.form.Button" type="submit" onclick=searchSubscribers()>
	            	Search
	</button> 
	
	
			 dojo.ready(function(){
	            var textbox = new dijit.form.TextBox({
	            	value: "Search By Name or Email",
	            	onFocus: function(){ 
	            		var ph = dijit.byId("searchName");
	            		ph.attr("value",""); },
	                placeHolder: "Search By Name or Email"
	            }, "searchName");
	            textbox.startup();
	            
			});
	
		
	
			function searchSubscribers() {
				var searchCriteria = dijit.byId("searchName").value;
				console.log('searchCriteria --> ' + searchCriteria);
				dojo.xhrGet({
	    		    // The URL of the request
	    		    url: "http://localhost:8080/SubscriberManagement/subscribers?searchBy=" + searchCriteria ,
	    		    handleAs: "json",
	    		    headers : {
	    		    	"Content-Type" : "application/json"
					},  
	    		    load: function(data, ioargs) {
	    		    	console.log("GET was successful with data " + data);
	    		        
	    		    },
	    		    // The error handler
	    		    error: function(error, ioargs) {
	    		    	console.log("GET failed with error " + error);
	    		        alert(error);
	    		    }
    		});

Can someone help me if I am proceeding in the correct way. I was expecting to mimic the first request so that I can display the grid again. But, the response now appears to be the entire jsp source.