1.jsp页面
<script type="text/javascript" src="/js/jquery-1.4.3.min.js"></script>
<%
chk.setFormName("res_spcatalogForm");
chk.CheckNull("adname","通道名不可为空");
out.println(chk.getCheckScript());
String province = "安徽,北京,福建,甘肃,广东,广西,贵州,海南,河北,河南,黑龙江,湖北,湖南,吉林,江苏" +
",江西,辽宁,内蒙古,宁夏,青海,山东,山西,陕西,上海,四川,天津,西藏,新疆,云南,浙江,重庆" ;
String[] provinces = province.split(",");
String serviceid = (String) request.getAttribute("serviceid");
String psql = "select province,willnum,realnum,tasknum from bbx_area where serviceid='" + serviceid + "'";
String qdid[][] = dbutils.getResultSetArray("select cpid,adname+serviceid from bbx_service where id='" + serviceid + "'" );
System.out.println(psql);
String passrate = "";
String tempContent[][] = dbutils.getResultSetArray(psql);
String maxvalue = "0",realvalue = "0",taskvalue = "0";
String[][] company=dbutils.getResultSetArray("select id,company from company");
String compan=request.getParameter("company");
%>
<script ID=clientEventHandlersJS language=javascript charset="GBK">
function checkbl(){
//alert("III");
$.ajax(
{
type:"post",
url:"/blAjaxa.do?action=blajax",
data:"company="+ $("select[name='company']").val(),
success: tt
}
)
}
function tt(bll){
$("#bl").empty();
$("#bl").append(bll);
}
</script>
<tr>
<td width="20%" class="labeltable_middle_td_01"><b>所属公司</b></td>
<%--<td width="80%"><html:text property="company" styleClass="input" size="50" maxlength="20"/></td>--%>
<td width="80%"> <html:select property="company" onchange="checkbl()">
<option value="" selected>请选择</option>
<%
for(int i=0; i < company.length; i++) {%>
<html:option value="<%=company[i][0]%>"><%=company[i][1]%>
</html:option>
<%}%>
</html:select>
</td>
</tr>
<tr>
<td width="60" class="labeltable_middle_td_01"><b>业务所属人</b></td>
<td width="80%"><select id="bl" name="bl" >
</select></td>
</tr>
2.struts-config.xml
<action path="/blAjaxa" scope="request" parameter="action" type="com.itc.wap.web.sms.blajax">
</action>
3.
public class blajax extends BaseAction
{
public ActionForward blajax(ActionMapping mapping,ActionForm Form,HttpServletRequest request,HttpServletResponse response)
throws Exception
{
String company = new String(request.getParameter("company").getBytes("ISO-8859-1"),"GBK");
System.out.println("-------------------------------company="+company);
blaja b=new blaja(); response.setCharacterEncoding("GBK");
response.getoutputStream().print( b.getbl(company));
return null;
} }
4.
public class blaja {
public String getbl(String com){
System.out.println("-------------------com="+com);
String bl="";
StringBuffer str = new StringBuffer();
/* String a = "<option value='001'>请选择</option>";
str.append(a);*/
try { String se="seleted=\"seleted\"";
bl= dbutils.getValue("select bl from company where id= '"+com+"'");
System.out.println("-------------------bl="+bl);
} catch (Exception e){
e.printstacktrace();
}
String opt = "<option seleted=\"seleted\" value='" + bl + "'>" + bl+"</option>";
System.out.println("--------------------="+opt);
str.append(opt);
return str.toString();
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。