< html:multibox>在Struts 2中等效 [英] <html:multibox> equivalent in Struts 2
本文介绍了< html:multibox>在Struts 2中等效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面是html标记多框,我想将其迁移到struts 2
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>
这篇关于< html:multibox>在Struts 2中等效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文