While loading the view page I am setting a session variable as:
request.session.setAttribute("list",list);
after that onclick of a button I am using ajax call to refresh the list. in backend I am able to see the latest list contents. But in UI I am using :
List<String> cList = (List<String>)session.getAttribute("list");
but even after the list is changed I am not able see the latest list contents.Still the old list contents are displaying on the page. Need some suggestions on how to resolve this issue.
var refreshThisDiv= "refreshThisDiv";
            var goUrl= "unametest/getUserNamesList;
            var httpRequest=null;
            var refreshContent = "null";
            httpRequest = XMLHTTPObject();
            httpRequest.open("POST", goUrl, true);
            httpRequest.onreadystatechange = function () {ajaxFcuntion(refreshThisDiv,httpRequest); } ;
            httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
            httpRequest.send(null);
//ajaxFcuntion
function ajaxFucntion(refreshThisDiv,httpRequest){
    if (httpRequest.readyState == 4)
    {
        if(httpRequest.status == 200)
        {
            results =  httpRequest.responseText; 
if(results!=null){
            <%
            List<String> list = (List<String>)request.getSession().getAttribute("list"); %>
//display data from list
}
}
 
     
    