Code for jsp dwr Cascade Effect

Source: Internet
Author: User

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 ";
}
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.