appfuse中选择框的使用(picklist.jsp)

appfuse中使用/common/pickList.jsp来处理多选,在开发的过程中开始照猫总是画不出虎来,后来才发现涉及到好几个地方。

1。pickList.jsp里面使用List<LabelValue>进行处理,因此要进行转换。比如左侧的availableRoles就是在StartupListener中把需要的数据放到context中。右侧的list是在User中提供getRoleList这样的辅助方法来获得。

2。在userForm.jsp中,需要增加下面的js,来保证提交的时候userRoles都被选中,否则数据就提交不上去:

<!-- This is here so we can exclude the selectAll call when roles is hidden -->
function onFormSubmit(theForm) {
    selectAll('userRoles');
    return validateUser(theForm);
}

以及form提交时调用这个函数:

<form:form commandName="user" method="post" action="editUser.html" οnsubmit="return onFormSubmit(this)" id="userForm">

3。UserFormController中,要对获得的userRoles参数进行处理。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值