直接帖测试代码
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
  <head>
<link rel="stylesheet" href="css/select2.css" type="text/css"></link>
<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="js/select2.full.js"></script>
<script type="text/javascript">
$(function(){
var data = [{ id: 0, text: 'enhancement' }, { id: 1, text: 'bug' },
 { id: 2, text: 'duplicate' }, { id: 3, text: 'invalid' }, { id: 4, text: 'wontfix' },
 { id: 5, text: 'enhancement' }, { id: 6, text: 'bug' },
 { id: 7, text: 'duplicate' }, { id: 8, text: 'invalid' }, { id: 9, text: 'wontfix' },
 { id: 10, text: 'enhancement' }, { id: 11, text: 'bug' },
 { id: 12, text: 'duplicate' }, { id: 13, text: 'invalid' }, { id: 14, text: 'wontfix' }];

$("#test1").select2({
data:data,
tags:true
});
});
var addOpt=function(){
$("#test1").append("<option value='0'>测试类型1</option>");
};
  </script>
  </head>
  <body>
    <table width="100%">
     <tr>
     <td>
     名称:
     <select id="test1"></select>
     </td>
     <td><button onclick="addOpt()">单击</button></td>
     </tr>
    </table>
  </body>
</html>初始化加载全部数据,无滚动条.求解