springside改进了一些taglib的输出模板,详见在mini-web的src/resources/theme/custom目录,在使用时要将theme设为custom,见Struts2资料
<s:checkboxlist> ,<s:radio>之类的select,check,radio taglib都挺好用的。
下例中Action里有一个List<Long> roleIds代表要选中的角色,一个List<Role> roleList代表完整的角色列表,Role有两个属性:id 和 name。
<div style="word-break:break-all;width:250px; overflow:auto; ">
<s:checkboxlist name="roleIds" list="roleList" listKey="id" listValue="name" theme="custom"/>
</div>
但<s:checkboxlist> 在选项较多的时候无法做到很好的换行与对, 因此Spring使用了table来实现,设定每行3个选项。
<s:actionerror>与<s:actionmessage>也是不错的标签,SpringSide也作了美化,比如可以点击关闭消息。