2级联动实现方式(ajax)

 AJAX.JSP ---------------------------------- <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><%@ page import="com.cmip.data.datastore.ValueDataSet" %><%@ page import="com.cmip.data.SqlUtil" %><% String regioncode=request.getParameter("regioncode");   ValueDataSet ds = getData(regioncode);       for (int i = 0; i < ds.getRowCount(); i++) {                ds.next();   %>     <%        } %><%!      private ValueDataSet getData(String id) {        StringBuffer sql = new StringBuffer();        sql.append("select  SREGION_ID,SREGION_NAME from T_CD_REGION  WHERE SLEVEL=2 and SPAR_REGION_ID=" + id + "");        ValueDataSet ds = null;        Object[] params = {};        try {            ds = SqlUtil.getInstance().executeQuery(sql.toString(), params);        } catch (Exception ex) {            ex.printStackTrace();        }        return ds;    }%> 脚本--- ----------------                 <%            ValueDataSet ds = getModuleData();             String[] row = new String[10];            for (int i = 0; i < ds.getRowCount(); i++) {                ds.next();                row[0] = su.checkNull(ds.getString("SREGION_ID"));                row[1] = su.checkNull(ds.getString("SREGION_NAME"));         %>                <%}%>       

你可能感兴趣的:(ajax,xmlhttprequest,string,function,import,exception)