hi I am querying database to load all items based on some criteria and setting this result in session as
data = service.getData();
session.setAttribute("data", data);
now I am trying to access this data via an Ajax call and my Ajax call is served by a different servlet rather then which fetched the data from DB.
Ajax call using jquery
$.ajax({
    type: "POST",
    url: "/com/tp/AjaxXML.jsp",
    data: ({cmd: "report"}),
    dataType: "xml",
    success: function(xml) {
        $(xml).find('site').each(function(){
            var url = $(this).attr('url');                                  
        });
    }
});
in my AjaxXML.jsp
I am doing
if("report".equals(cmd)){
    List<Object> data = (List<Object>)request.getSession().getAttribute("data");
    if(data == null){
        System.out.println("data is null ");
    }
}
every time I am getting the data as null via the Ajax call how ever I try to access the session data normally from my first servlet it works.
could someone let me know if I am doing something wrong?
I noticed one more thing when we do session.getId(); and pageContext.getSession().getId();
both of them are returning different Id's? Is this expected to me they should be same anyone differ on that?
 
     
     
    