DWR. jsp
<SCRIPT src = "DWR/interface/juserchec. js"> </SCRIPT>
<SCRIPT src = "DWR/engine. js"> </SCRIPT>
<SCRIPT src = "DWR/util. js"> </SCRIPT>
<SCRIPT type = "text/JavaScript">
Function changeqx (P)
{
Var val = P. value;
// Alert (VAL );
Juserchec. jilian (Val, haschange );
}
Function haschange (changeval)
{
// Alert (changeval );
VaR JD = Document. getelementbyid ("JD ");
VaR op = New Option (changeval, changeval );
JD. Options. Length = 0;
JD. Options. Add (OP );
}
</SCRIPT>
<Body>
<Br>
<Select onchange = "changeqx (this)">
<Option value = "A"> A </option>
<Option value = "B"> B </option>
<Option value = "C"> C </option>
</SELECT>
<Select id = "JD">
</SELECT>
</Body>
DWR. xml
<? XML version = "1.0" encoding = "gb2312"?>
<! Doctype DWR
Public "-// getahead limited // DTD direct Web remoting 2.0 // en"
Http://getahead.org/dwr/dwr20.dtd>
<DWR>
<Allow>
<Create creator = "new" javascript = "juserchec">
<Param name = "class" value = "com. Struts. usermanager"/>
<Include method = "CCC"/>
<Include method = "jilian"/>
</Create>
</Allow>
</DWR>
Usermanager. Java
Package com. Struts;
Public class usermanager {
Public Boolean CCC (string uname ){
If ("ABC". Equals (uname )){
Return true;
}
Return false;
}
Public String jilian (string QX ){
If ("A". Equals (QX )){
Return "A1 # A2 # A3 ";
}
If ("B". Equals (QX )){
Return "B1 # B2 # B3 ";
}
Return "C1 # C2 ";
}
}