0

I am calling a servlet on ready like,

$(document).ready(function(){   
        $.ajax({  
            type: "GET",  
            url: "UserInfoDisplay"                       
          });   
    });

In my servlet's doGet method I have,

SuperUserAdminDAO superUser = new SuperUserAdminDAO();
List<AuthorizeUser> authorizeUserList =superUser.getUserInfo();     
request.setAttribute("userInfo", authorizeUserList);    
request.getRequestDispatcher("/UserAdmin.jsp").forward(request, response);

When I print my list, I am able to see it on the console but the change is not getting reflected in my jstl core foreach,

<select id="uid">
<c:forEach var="uid" items="${userInfo}">
  <option value="${uid.auid}">${uid.auid}</option>
</c:forEach>

What am I missing out?

4

1 回答 1

0
      $.ajax({  
        type: "GET",  
        url: "UserInfoDisplay" ,
        success: function(result){ 
          buildSelect(result);
         }                      
      });  

function buildSelect(results)
{
  for(var i in results)
     $('#uid').append('<option value="'+results[i].auid+'">'+results[i].auid+'</option>');

}
于 2013-06-05T10:28:17.787 回答