HttpServletRequest request, HttpServletResponse response) (
String level2OrganId = request.getParameter ( "level2OrganId");
System.out.print (level2OrganId);
IDReportLogic dreportLogic = (IDReportLogic) SpringFactory.getBeanFactory (). GetBean ( "dreportLogic");
response.setContentType ( "text / xml; charset = UTF-8");
response.setHeader ( "Cache-control", "no-cache");
try (
String orgLevel = request.getParameter ( "orgLevel");
String orgId = request.getParameter ( "orgId");
/ ** / / *
The following were received for the future structure of the xml.
StringBuffer sb = new StringBuffer ();
sb.append ( "<? xml version = \" 1.0 \ "encoding = \" UTF-8 \ "?>");
String str = "<select> <kkk> <value> 11111 </ value> <text> Beijing </ text> </ kkk>";
String str2 = "<kkk> <value> 3333 </ value> <text> Shanghai </ text> </ kkk> </ select>";
sb.append (str);
sb.append (str2); * /
PrintWriter out = response.getWriter ();
out.write (str);
out.flush ();
return null;
) Catch (Exception e) (
/ / TODO Auto-generated catch block
request.setAttribute ( "info", "access to secondary institutions abnormal!");
e.printStackTrace ();
return mapping.getInputForward ();
)
)
Secondary institutions:
<Select name = "secOrganIdSel" id = "secOrganIdSel"
onchange = "selectChangeListener ('2 ', this.options [this.selectedIndex]. value);">
<Option value = "-1"> Please select institutions .. </ option>
</ Select>
Three institutions:
<Select name = "thdOrganIdSel" id = "thdOrganIdSel"
onchange = "selectChangeListener ('3 ', this.options [this.selectedIndex]. value);">
<Option value = "-1"> Please select institutions .. </ option>
</ Select>
Four agencies:
<Select name = "forthOrganIdSel">
<Option value = "-1"> Please select institutions .. </ option>
</ Select>
<Script language = "javascript" type = "text / javascript">
var xmlHttp;
function createXMLHttpRequest () (
if (window.ActiveXObject) (
xmlHttp = new ActiveXObject ( "Microsoft.XMLHTTP");
) Else if (window.XMLHttpRequest) (
xmlHttp = new XMLHttpRequest ();
)
)
/ / Query the specified page
function selectChangeListener (orgLevel, orgId) (
createXMLHttpRequest ();
var url = "<% = request.getContextPath ()%>/ dreportAction.do? method = getOrganinfo_ajax & orgLevel =" + orgLevel + "& orgId =" + orgId;
xmlHttp.open ( "get", url, true);
if (orgLevel == '2') (
/ / If this is the first choice of the default, it is clear after the three bodies and four bodies.
var tempSel = document.getElementById ( "secOrganIdSel");
if (tempSel.options [tempSel.selectedIndex]. value == - 1) (
var tempSel_1 = document.getElementById ( "thdOrganIdSel");
tempSel_1.options.length = 1;
var tempSel_2 = document.getElementById ( "forthOrganIdSel");
tempSel_2.options.length = 1;
return false;
)
xmlHttp.onreadystatechange = callback2;
) Else if (orgLevel == '3') (
/ / If the default three-tier institutions is the first option is empty the first four institutions
var tempSel = document.getElementById ( "thdOrganIdSel");
if (tempSel.options [tempSel.selectedIndex]. value == - 1) (
var tempSel_2 = document.getElementById ( "forthOrganIdSel");
tempSel_2.options.length = 1;
return false;
)
xmlHttp.onreadystatechange = callback3;
)
xmlHttp.send (null);
)
/ / Return to information processing, secondary institutions to return to the results of the drop-down list
function callback2 () (
if (xmlHttp.readyState == 4) (
if (xmlHttp.status == 200) (
var xmlDoc = xmlHttp.responseXML;
changeSel ( '2', xmlDoc);
) Else (
window.alert ( "The page you have requested are abnormal.");
)
)
)
/ / Return to information processing, three-tier institutions to return to the results of the drop-down list
function callback3 () (
if (xmlHttp.readyState == 4) (
if (xmlHttp.status == 200) (
var xmlDoc = xmlHttp.responseXML;
changeSel ( '3', xmlDoc);
) Else (
window.alert ( "The page you have requested are abnormal.");
)
)
)
/ / Update the agency drop-down list
function changeSel (orgLevel, xmlDoc) (
/ / Var xsel = xmlDoc.getElementsByTagName ( 'kkk');
var xsel = xmlDoc.documentElement.childNodes;
/ / Alert (xsel.length);
if (orgLevel == '2') (
/ / Secondary institutions, 3 institutions and agencies need to clear 4.
var tempSel_1 = document.getElementById ( "thdOrganIdSel");
tempSel_1.options.length = 0;
tempSel_1.add (new Option ( 'Please select the institutions',' - 1 '))
var tempSel_2 = document.getElementById ( "forthOrganIdSel");
tempSel_2.options.length = 0;
tempSel_2.add (new Option ( 'Please select the institutions',' - 1 '))
for (var i = 0; i <xsel.length; i + +) (
var xvalue = xsel [i]. childNodes [0]. firstChild.nodeValue;
var xtext = xsel [i]. childNodes [1]. firstChild.nodeValue;
var option = new Option (xtext, xvalue);
tempSel_1.add (option);
)
) Else if (orgLevel == '3') (
/ / Three-level institutions, institutions need to empty the four
var tempSel_2 = document.getElementById ( "forthOrganIdSel");
tempSel_2.options.length = 0;
tempSel_2.add (new Option ( 'Please select the institutions',' - 1 '))
for (var i = 0; i <xsel.length; i + +) (
var xvalue = xsel [i]. childNodes [0]. firstChild.nodeValue;
var xtext = xsel [i]. childNodes [1]. firstChild.nodeValue;
var option = new Option (xtext, xvalue);
tempSel_2.add (option);
)
)
)
</ Script>







