当前位置:主页 > 查看内容

jsp dwr级联效果代码

发布时间:2021-07-19 00:00| 位朋友查看

简介: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)……
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";
}
}

本文转载自网络,原文链接:https://m.jb51.net/article/15978.htm
本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!

推荐图文


随机推荐