Freemaker 学习记录(持续更新)

1.循环遍历 list

<#list orderDtoPage.content as orderDto>

<tr>
    <td>
    ${orderDto.orderId}
    </td>
</tr>

2.判断 非空

如果是对象的话如下判断

<img src="${(productInfo.productIcon)!''}">

否则

${productIcon!=''}

3.判断存在且相等 

<select class="form-control" name="categoryType" id="categoryType" >
    <#list  categoryList as category>
        <#if (productInfo.categoryType)??&&(productInfo.categoryType)==(category.categoryType) >
<option value="${category.categoryId}" selected="selected">${category.categoryName}</option>
        <#else>
            <option value="${category.categoryId}" >${category.categoryName}</option>
        </#if>
    </#list>
</select>

猜你喜欢

转载自blog.csdn.net/hanzl1/article/details/80878148