1、后台返回一个list,并封装成json;

 public void loadDep() {

// 根据单位获取所有部门信息

tblUserDepartmentList = (List<TblUserDepartment>)workResService.find("From             TblUserDepartment t where t.delFlag ='" + Constants.DELFLAGA + "' and             t.userUnitId ='"+unitId+"' order by t.sort");

// 把list转换成json格式

this.responseAJAX(JSONArray.fromObject(tblUserDepartmentList).toString(),         getResponse());

 }

2、前台接收处理:

<script type="text/javascript">

    function loadDep1() {

  var unitId = $("#hidden_selectedUserUnit").val();

        // 赋值之前把上次的值清空

$("#depSel").empty();

$.post('workRes_loadDep.action',{"unitId":unitId},function(result){

result = $.parseJSON(result);

$.each(result,function(i){

 $("#depSel").append("<option     value='"+result[i].userDepartmentId+"'>"+result[i].name+"</option>");  

  });

});

}


</script>

jsp 表单为:

  <select id="depSel" name="tblWrPeople.userDepartmentId" style="width: 130px">

   </select>