嗨在我的jsp頁面我有一個jquery區域,它將值傳遞給一個servlet,該servlet返回dropdownlist的輸出。那麼jsp文件會進行一些更新,因此在重新填充時,下拉列表中的某些值不應存在。但它沒有發生。我jQuery代碼是jquery正在從數據庫中獲取舊值
$("#cbocode").change(function(){
var cdid=$("#cbocode option:selected");
$.get("trnDC?caseNo=20&cdid="+cdid.text(),function(data){
$("#divinstrument").html(data);
})
和servlet代碼是
case 20:{ //jquery call
String cdid=(String) request.getParameter("cdid");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select instrumentid from mstinstrument where codeid='" + cdid + "' and rec_Status='A' and statusid='U' and Agentid='METLAB'");
if (!rs.wasNull()){
//List data=new ArrayList();
String v="<select id=cboinstr>";
while (rs.next())
{
// data.add(rs.getString("vend_code"));
v += "<option>" + rs.getString("instrumentid").toString() + "</option>";
}
v+="</select>";
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.print(v);
}
else{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.print("no data found");
}
我在哪裏丟失的???
感謝老闆,現在是區加工 – sansknwoledge 2010-03-23 10:34:48