0

I have one jsp page, on load of jsp, two radio button is there, on click of first radio button, i am doing an ajax call with no data and it will go to controller and method will return a list object but it is not even hitting the controller method

My ajax code is like this :

 $("#radio1").click(function(){
    alert('success');   
    debugger;
    $.ajax({
        method : 'GET',
        url : 'ConnectionStringDetails',
        data: {},
        success: function(data){   
            alert('True');

        },
        error: function() {
            alert('unsuccessfull');
            }
    });   

and controller method is like this:

@RequestMapping("/ConnectionStringDetails")
@ResponseBody
public List<ConnectionString> ConnectionStringDetails()
{

    List<ConnectionString> conndetail=null;
    System.out.println("ConnectionStringDetails");

        conndetail=bdpService.getSourcesData();

    return conndetail;
}
Kirti
  • 1
  • 1
  • what does the browser network call view show? – Rohit Nov 23 '15 at 14:12
  • Need more details... Do you have any mapping on the controller? How are you running the app? Do you have web.xml? What url do you see in the browser debugger? – jny Nov 23 '15 at 14:26
  • @Rohit : it is not showing any data in n/w call view, just showing the method name i.e ConnectionStringDetails – Kirti Nov 24 '15 at 06:36
  • @jny, yes, web.xml is there but m using RequestMapping annotation for mapping and same passing in url of ajax call, other ajax calls in project in which m passing data is working, only this one (with no data), is giving problem. – Kirti Nov 24 '15 at 06:41
  • @rohit, when m clicking on radio button, it is just showing that alert('success') and then unsuccessfull – Kirti Nov 24 '15 at 06:54
  • now, in n/w, it is showing this exception on clicking of the method: HTTP Status 500 - Could not write content: failed to lazily initialize a collection of role: – Kirti Nov 24 '15 at 07:22
  • @Rohit actually, problem is with controller because of the List return type, if m giving return type is string, it is working fine but i need list of objects to be returned – Kirti Nov 24 '15 at 07:52
  • @Kirti, are you using Hibernate or something similar? If yes, you have to figure out how you want to deal with lazy initialization. http://stackoverflow.com/questions/14360216/mvc-with-lazy-loading – jny Nov 24 '15 at 14:08

0 Answers0