页面:
<script type='text/javascript' src='dwr/interface/timeLimitMVManager.js'></script>
<script type='text/javascript' src='dwr/engine.js'></script>
<script type='text/javascript' src='dwr/util.js'></script>
<tr>
<th>
<fmt:message key="timelimitmv.tyep.name"/>
</th>
<td>
<select name="match_type_work_char_id" onchange="changeType(this)" id="match_type_work_char_id">
<option value=""><fmt:message key="msgtem.default" /></option>
<option value="1"><fmt:message key="timelimitmv.type1"/></option>
<option value="2"><fmt:message key="timelimitmv.type2"/></option>
<option value="4"><fmt:message key="timelimitmv.type4"/></option>
</select>
</td>
</tr>
<tr>
<th>
<fmt:message key="timelimitmv.value.name"/>
</th>
<td>
<select name="begin_value" id="begin_value">
<option value="1" ><fmt:message key="timelimitmv.type1"/></option>
<option value="2"><fmt:message key="timelimitmv.type2"/></option>
<option value="4"><fmt:message key="timelimitmv.type4"/></option>
</select>
</td>
</tr>
function changeType(sel_obj)
{
var match_type_work_char_id=sel_obj.value;
if(match_type_work_char_id=='')
return;
timeLimitMVManager.getVNByTN(match_type_work_char_id,showValue);
}
function showValue(dis)
{
DWRUtil.removeAllOptions('begin_value');
DWRUtil.addOptions('begin_value',dis,'begin_value','value_name');
}
dwr.xml:
<allow>
<create creator="spring" javascript="timeLimitMVManager">
<param name="beanName" value="timeLimitMVManager"/> --由SPRING进行管理的MANAGER名称--
<include method="getVNByTN"/> --暴露给页面的方法--
</create>
</allow>
manager方法:
public List getVNByTN(String match_type_work_char_id) {
// TODO Auto-generated method stub
List obs=null;
if(match_type_work_char_id!=null){
if(match_type_work_char_id.equals("1")){
obs=timeLimitMVDAO.getSBLXById();
}
if(match_type_work_char_id.equals("2")){
obs=timeLimitMVDAO.getKUPPById();
}
if(match_type_work_char_id.equals("4")){
obs=timeLimitMVDAO.getCXBZById();
}
}
return obs;
}