jsp dwr级联效果代码
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>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";
}
}
您可能感兴趣的文章:- 纯JSP+DWR实现三级联动下拉选择菜单实现技巧
- DWR util.js 学习笔记 整理
- Java多线程 ReentrantReadWriteLock原理及实例详解
- Java语言ReadWriteLock特性实例测试
- PipedWriter和PipedReader源码分析_动力节点Java学院整理
- Java 中的 BufferedWriter 介绍_动力节点Java学院整理
- Spring Boot启动过程(六)之内嵌Tomcat中StandardHost、StandardContext和StandardWrapper的启动教程详解
- DWR中各种java方法的调用
- 基于JQuery和DWR实现异步数据传递