Struts2 cssclass:struts2 CheckBoxList Label Settings CssClass Property The check does not have a class attribute problem in the HTML code generated

Source: Internet
Author: User
Tags contains include

After you set the CssClass property with the Struts2 CheckBoxList tab, you find that the input tag in the generated HTML code does not have a class attribute.
Open CHECKBOXLIST.FTL Look, the contents are as follows:
<input type= "checkbox" Name= "${parameters.name?html}" value= "${itemkeystr?html" id= "${parameters.name?html}-${" ItemCount} "< #rt/>
< #if tag.contains (Parameters.namevalue, Itemkey) >
Checked= "Checked" < #rt/>
</#if >
< #if Parameters.disabled?default (false) >
disabled= "Disabled" < #rt/>
</#if >
< #if parameters.title?? >
Title= "${parameters.title?html}" < #rt/>
</#if >
< #include "/${PARAMETERS.TEMPLATEDIR}/SIMPLE/SCRIPTING-EVENTS.FTL"/>
< #include "/${PARAMETERS.TEMPLATEDIR}/SIMPLE/COMMON-ATTRIBUTES.FTL"/>
/>
No CssClass parameters are set at all.
Add the following, in the replacement struts2 package
Checkboxlist.ftl
The file is OK:
< #if parameters.cssclass?? >
class= "${parameters.cssclass?html}" < #rt/>
</#if >
The complete FTL file is as follows:
< #assign ItemCount = 0/>
< #if parameters.list?? >
<@s.iterator value= "Parameters.list" >
< #assign ItemCount = ItemCount + 1/>
< #if Parameters.listkey?? >
< #assign Itemkey = Stack.findvalue (Parameters.listkey)/>
< #else >
< #assign Itemkey = Stack.findvalue (' top ')/>
</#if >
< #if parameters.listvalue?? >
< #assign Itemvalue = stack.findstring (parameters.listvalue)? Default ("")/>
< #else >
< #assign Itemvalue = stack.findstring (' top ')/>
</#if >
< #assign itemkeystr=itemkey.tostring ()/>
<input type= "checkbox" Name= "${parameters.name?html}" value= "${itemkeystr?html" id= "${parameters.name?html}-${" ItemCount} "< #rt/>
< #if tag.contains (Parameters.namevalue, Itemkey) >
Checked= "Checked" < #rt/>
</#if >
< #if Parameters.disabled?default (false) >
disabled= "Disabled" < #rt/>
</#if >
< #if parameters.title?? >
Title= "${parameters.title?html}" < #rt/>
</#if >
< #if parameters.cssclass?? >
class= "${parameters.cssclass?html}" < #rt/>
</#if >
< #include "/${PARAMETERS.TEMPLATEDIR}/SIMPLE/SCRIPTING-EVENTS.FTL"/>
< #include "/${PARAMETERS.TEMPLATEDIR}/SIMPLE/COMMON-ATTRIBUTES.FTL"/>
/>
<label for= "${parameters.name?html}-${itemcount}" class= "Checkboxlabel" >${itemValue?html}</label>
</@s.iterator>
< #else >

</#if >
<input type= "hidden" id= "__multiselect_${parameters.id?html}" Name= "__multiselect_${parameters.name?html}" Value= "" < #rt/>
< #if Parameters.disabled?default (false) >
disabled= "Disabled" < #rt/>
</#if >
/> This article links http://www.cxybl.com/html/wyzz/CSS/20130806/39524.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.