目的:实现下拉列表的动态加载
相关技术:jquery1_3_2.js,struts1.2
别的不瞎扯,直接看代码..
界面jquery调用:
function sel_1() {
  $("#userName").html("正在加载...");
    var url = "<%=path%>/issueAction.do?action=show_name";
    $.post(url,{role:'1'},function(data){
    $("#userName").html(data);
  });
}要动态加载的select标签
<div id="userName">
<select name="user">
  <option value="0">--请选择--</option>
         </select>
</div>后台action调用:
public ActionForward show_name(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");
response.setHeader("Cache-Control", "no-cache");
PrintWriter out = null;
try {
out = response.getWriter();
} catch (IOException e) {
e.printStackTrace();
}
String roel_ = request.getParameter("role");
List list = null;
int role = (roel_ != null) ? Integer.parseInt(roel_) : 1;
list = issue_impl.getNameListByRole(role);
String strResult = "<select name=\"user\"><option value=\"0\">---请选择---</option>";
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
Object[] obj = (Object[]) list.get(i);
strResult += "<option value='" + obj[0] + "'>" + (String) obj[1]
+ "</option>";
}
}
strResult += "</select>";
System.out.println(strResult);
out.print(strResult);
return null;
}问题:使用此标签可以实现动态加载,但是使用:
<div id="userName">
<html:select name="user">
  <html:option value="0">--请选择--</html:option>
         </html:select>
</div>
只能显示值,而没有下拉列表的效果,请问是什么原因? 大家帮帮忙...分数不多了,请大家帮帮忙吧