freemark常见用法

来源:互联网 发布:win10修改电脑mac地址 编辑:程序博客网 时间:2024/05/19 11:35

freemark常见用法

使用boolean变量

window.canBuyMore=true;        window.buyMorePeroid=${buyMorePeroid!0};        window.isSuite=${isSuite?c};/*http://stackoverflow.com/questions/19330013/freemarker-boolean-attribute-retrieval */

防xss攻击

 <#escape x as x?html>                                        <#if orgFullName?length lt 15   >                                            ${orgFullName}                                            <#else>                                                ${orgFullName[0..13]}...                                        </#if>                                    </#escape>

截断指定长度

<li  data-orgid="${item.orgId}" class="<#if item.defaultSelect! == '1' >li-active enabled_hover <#elseif item.canBuy==false>li-none disabled<#else>enabled</#if>" title="<#escape x as x?html>${item.orgName}</#escape>" ><#if item.orgName=="">未命名企业<#else><#escape x as x?html>                                    <#if item.orgName?length lt 15   >                                        ${item.orgName}                                        <#else>                                            ${item.orgName[0..13]}...                                    </#if>                                </#escape></#if></li>

The following has evaluated to null or missing

原因:要显示的字段没有getter方法

1 0
原创粉丝点击