我使用的JSP包含两个下拉列表,
问题圈:下拉列表
CPC:下拉列表
<tr>
<td align="left" class="tC" width="30%"><bean:message
key="label.issueCircle" />:*</td>
<td align="left" class="tE"><bean:define id="circleList"
name="sessionData" property="circleList" /> <html:select
property="circle" tabindex="9" styleClass="mediumDropInput"
style="width:45%" onchange="getCount()">
<html:options collection="circleList" property="value"
labelProperty="label" />
</html:select></td>
</tr>
<tr>
<td align="left" class="tC" width="30%"><bean:message
key="label.cpc" />:*</td>
<td align="left" class="tE"><bean:define id="cpcList"
name="sessionData" property="cpcList" /> <html:select
property="cpc" tabindex="9" styleClass="mediumDropInput"
style="width:45%" onchange="getCount()">
<html:options collection="cpcList" property="value"
labelProperty="label" />
</html:select></td>
</tr>
每次点击费用的值取决于问题圈,并且不同圈子的值不同。
我正在使用AJAX来执行此功能。
<SCRIPT LANGUAGE="JavaScript">
function getCount() {
var url = "/NewBusiness/populateCircle.do";
var value="Maharashtra"; //Hardcoded value
var parameters="mah="+value;
// Perform the AJAX request using a non-IE browser.
if (window.XMLHttpRequest) {
request = new XMLHttpRequest();
// Register callback function that will be called when
// the response is generated from the server.
request.onreadystatechange = updateCount;
try {
request.open("POST", url, true);
} catch (e) {
alert("Unable to connect to server to retrieve count.");
}
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
request.send(parameters);
// Perform the AJAX request using an IE browser.
} else if (window.ActiveXObject) {
request = new ActiveXObject("Microsoft.XMLHTTP");
if (request) {
// Register callback function that will be called when
// the response is generated from the server.
request.onreadystatechange = updateCount;
request.open("GET", url, true);
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
request.send(parameters);
}
}
}
function updateCount() {
if (request.readyState == 4) {
if (request.status == 200) {
var count = request.responseText;
alert(request.responseText); //How i can set this value to "CPC: Drop down list"
alert(count);
} else {
alert("Unable to retrieve count from server.");
}
}
}
我正在发送AJAX请求参数(issure Circle-value),我必须在其中设置下拉列表。 我无法在我的动作类中填充'cpc'下拉列表,它需要引用我的整个页面。
sessionData.setCpcList(cpcList); //Not reflecting in JSP page...Needs to referesh page
不使用整个jsp页面参考如何才能实现此功能?