我想用Struts中的下拉框实现一个功能,功能是,在A页面当下拉框的值发生变化时触发onchange事件,提交到一个Action,在进行业务处理,然手在返回到A页面,这时下拉框的值要是,事件后我选择的值,而非它自已默认选中的,怎么实现啊? 我是用LableValueBean来设置select值的
请大家教我,谢谢。
解决方案 »
- 急急急!!!!!No result defined for action and result success
- 针对没有工作或者想找点java网站做的人士看
- 库房管理系统中,库存查询怎么做
- 济南有哪几家IT公司没有乙肝歧视,请帮助答一下,万分感谢!
- struts form的生命周期是什么?
- 做java但不愿做界面,这样好找工作吗?
- 问一个JBuilder7的package问题
- 谁给我J2EE方面的部署资料呢,收到就给分
- 我的JBuilder7为什么隔一会儿就闪一下啊??不知道哪位大侠能帮忙解决一下?
- 在Java中如何使用spark来解析eml邮件?
- 谁给我移动收费的源代码啊?给个建议也行
- 一个用google Api结合java做的深圳楼盘系统,请大家多指教!!!
<html:optionsCollection name="lableValueList" />
</html:select>
选一个值--onchange--提交,我这的名称是code,所以这个值会被提交到你的actionForm的code字段中,
在action中处理完业务返回页面时,只要保证actionForm的code字段仍然是刚刚你提交的那个值,
页面的select就会自动对应上刚才你所选的
//JS
function go()
{
var customerId = document.Form.mrCustomer.value;
location.href="/action.do?customerId=" + customerId;
}
//END JS<html:select property="mrCustomer" style="width:170px" onchange="goJobsite();" >
<logic:present name="customerList" scope="request">
<html:options collection="customerList" property="customerId" labelProperty="customerName" />
</logic:present>
</html:select>
ACTION:
meterReadingForm.setMrCustomer(request.getParameter("customerId"))能看懂吧
在 Action 处理完之后又把这个值放入 request 中去
比如: request.setAttribute("parameterName","selectValue");
在页面上用 EL 取出来 比如 : value="${requestScope.parameterName}"
//JS
function go()
{
var customerId = document.Form.mrCustomer.value;
location.href="/action.do?customerId=" + customerId;
}
//END JS <html:select property="mrCustomer" style="width:170px" onchange="goJobsite();" >
<logic:present name="customerList" scope="request">
<html:options collection="customerList" property="customerId" labelProperty="customerName" />
</logic:present>
</html:select>
ACTION:
meterReadingForm.setMrCustomer(request.getParameter("customerId")) 能看懂吧 中的“customerList”在哪里定义的啊?
楼主【myzhou】截止到2008-06-26 23:50:15的历史汇总数据(不包括此帖):
发帖数:3 发帖分:80
结贴数:0 结贴分:0
未结数:3 未结分:80
结贴率:0.00 % 结分率:0.00 %
如何结贴请参考这里:http://topic.csdn.net/u/20080501/09/ef7ba1b3-6466-49f6-9d92-36fe6d471dd1.html