Parameter setting <s: checkboxlist> is displayed vertically in struts2
* I need a checkbox option to display vertically instead of the default horizontal display. I created a folder in my src folder in the name templates and in another folder called vertical-checkbox containing the modified .ftl file of my custom checkbox. I can not display the custom checkbox My code in JSP
<s:checkboxlist theme="vertical-checkbox" label="Which of the following are states of India"
name="states"
list="#{'01':'January','02':'February','03':'March','04':'April',
'05':'May'}"
/>
Please advice where I am wrong.
Typically, the layout flag of locations in struts2 horizontally adjusts the flags. In most applications, we want to display checkboxes vertically (row by row). To align vertically, we must do the following
src
, ( )
struts-2.1.6/src/core/src/main/resources/template/simple/checkboxlist.ftl . . , , , : http://codeglobe.blogspot.com/2009/09/struts2-align-check-box-vertical.html
<s:checkboxlist list="urlist" name="selectedValues" listKey="id" listValue="descrption" theme="vertical-checkbox"></s:checkboxlist>
. , , , , src .
, , , , . , css:
<s:checkboxlist
name="myCheckboxList"
... />
html- :
<input type="checkbox" id="myCheckboxList-1" ... />
<label for="myCheckboxList-1" ...
<input type="checkbox" id="myCheckboxList-2" ... />
<label for="myCheckboxList-2" ...
CSS :
label[for*=myCheckboxList-]:after {
content:"\A"; white-space:pre;
}
, " , " myCheckboxList- ", " ( "\ A" ) , ".
: http://klyuty.blogspot.it/2011/03/creating-vertical-orientation-for.html , .
- WEB-INF/classes .
- WEB-INF/classes/template ( ).
- checkboxlist.ftl struts2-core.jar(, jar).
- ( . ):
for="${parameters.name?html}-${itemCount}" class="checkboxLabel">${itemValue?html}
:
</@s.iterator>
( ):
<#if parameters.cssStyle?exists>
<#if "${parameters.cssStyle?html}" == "vertical">
<br/><#rt/>
</#if>
</#if>
"vertical" - css, strust2,
- .
struts2 s: checkboxlist "vertical" :
. : http://mikeski.net/site/node/16
, :
- checkboxlist.ftl
3 , checkboxlist.ftl . , :
<#include "/${parameters.templateDir}/simple/checkboxlist.ftl" />freemarker, URL.
I did it and it worked for me. It will display your checkbox on a separate line.