<html:multibox>相当于 Struts 2 [英] <html:multibox> equivalent in Struts 2

查看:47
本文介绍了<html:multibox>相当于 Struts 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我想将它迁移到 struts 2 的 html 标签 multibox

Below is the html tag multibox which i want to migrate it to struts 2

<html:multibox name="unitForm" property="eservices">
    <bean:write name="service"/>
</html:multibox>

因为它是复选框,所以想到使用迭代器中的简单复选框,所以我使用了下面的代码

as it is checkbox so thought of using simple checkbox which is in the iterator so i used below code

<s:checkbox theme="simple" name="unitForm.eservices"></s:checkbox>

在行动

String[] toArray = new String[selectedadminVOs.size()];
unitForm.setEservices(selectedadminVOs.toArray(toArray));

卡在这里,动作代码没有变化或变化很小,我如何将其迁移到 struts2

stuck here,without or minimal changes in action code how can i migrate it to struts2

推荐答案

Strust2 中的等价物是

The equivalent in Strust2 is

<s:iterator var="row" value="%{unitForm.eservices}">
    <input type="checkbox" name="unitForm.checked" 
        value="${row.service}" ${unitForm.checked.contains(row.service)?'checked="checked"':''}/>    
</s:iterator>

或者你可以使用s:property标签

<s:iterator var="row" value="%{unitForm.eservices}">
    <input type="checkbox" name="unitForm.checked" 
        value="${row.service}" <s:property value="%{unitForm.checked.contains(#row.service)?'checked="checked"':''}"/>/>    
</s:iterator>

这篇关于&amp;lt;html:multibox&gt;相当于 Struts 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆