Sunday, September 20, 2009

Struts2 align check box vertical

Normally the struts checkboxlist in struts2 diaply the check boxes horizontally. In most of application we want todisplay the check boxes vetrically ie line by line. For aligning this as vertical we have to do as specified below1) You have to create a directory template in your src folder2) create a folder with name of the template you want to create (vertical-checkbox)3) copy the struts-2.1.6/src/core/src/main/resources/template/simple/checkboxlist.ftl file to this directory content of this file is as follows. Before the </@s.iterator> you have to put a <br> tag as I given in this

4) <s:checkboxlist list="urlist" name="selectedValues" listKey="id" listValue="descrption" theme="vertical-checkbox"></s:checkboxlist>this will give you vertical check box listonly difference is that here you have to specify the theme which is same as the directory u have created in the template directory in the src folder of your project