cmbDj 是一个 dhtmlxCombo
formCxtj 是一个 form
cmbDj = formCxtj.getCombo("cmbDj"); //获得 cmbDJ 对象
cmbDj.loadXML("getCmbXml02.jsp"); //载入 xml
getCmbXml02.jsp 内容如下
<%@page contentType="text/html; charset=UTF-8"%>
<%
StringBuilder strXML = new StringBuilder("<?xml version='1.0'?>");
strXML.append("<complete>");
strXML.append("<option value=\"1\">one</option>");
strXML.append("<option value=\"2\">one</option>");
strXML.append("<option value=\"3\">one</option>");
strXML.append("</complete>");
out.print(strXML);
%>
结果下拉列表框无内容!!!!!
如果改成。。。。。如下代码
cmbDj = formCxtj.getCombo("cmbDj"); //获得 cmbDJ 对象
cmbDj.loadXML("getCmbXml03.jsp"); //载入 xml
getCmbXml03.jsp 内容如下。。。。。。
<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="java.sql.*"%>
<%@page import="java.util.*, java.io.*" pageEncoding="UTF-8"%>
<%!
String DBDRIVER = "oracle.jdbc.driver.OracleDriver";
String DBURL = "jdbc:oracle:thin:@192.168.230.128:1521:oraJava";
String DBUSER = "xarb";
String DBPASS = "xarb";
Connection conn = null ; // 数据库连接
PreparedStatement pstmt = null ; // 数据库操作
ResultSet rs = null ; // 查询结果集
%>
<%
Class.forName(DBDRIVER);
conn = DriverManager.getConnection(DBURL,DBUSER,DBPASS);
String sql = "select jc from zdlj order by xh";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
%>
<%
String item_url=request.getParameter("item_url");
if(item_url==null)item_url="http:IP\\xx.flv";
StringBuilder strXML = new StringBuilder("<?xml version='1.0' encoding='utf-8'?>");
strXML.append("<complete>");
while(rs.next()){
strXML.append("<option value=\"" + rs.getString("jc").trim() + "\">" + rs.getString("jc").trim() + "</option>");
}
if(rs != null) rs.close();
if(pstmt != null) pstmt.close();
if(conn != null) conn.close();
strXML.append("</complete>");
out.print(strXML);
%>
结果下拉列表框还是无内容!!!!! 求解
如果用php cmbDj.loadXML("getCmbXml02.php");
getCmbXml02.php 返回xml数据是可以的,有结果的
本人刚接触jsp
------解决方案--------------------
楼主那个版本是4.0以前的吧?现在没有loadXml这个方法了,都是load