Freemarker请求spring.binding的范围变量

时间:2015-03-02 05:22:16

标签: spring-mvc freemarker

我正在使用Freemarker和Spring MVC。

在这段代码中,当我尝试在删除表单中绑定嵌套对象的局部变量“Price”时,它失败,没有可用于绑定的对象。在JSTL中,我通过使用<c:set />将嵌套价格添加到请求范围来解决此嵌套对象问题。

Freemarker中是否有相同的方法可以做到这一点?或者推荐的替代方法?

<#list product.prices as price>                           
<tr>
    <td>${price.priceList.name}</td>
    <td>${price.priceList.currency}</td>
    <td>${DateUtils.formatTime(price.startTime!)}</td>
    <td>${DateUtils.formatTime(price.endTime!)}</td>
    <td>${price.price}</td>
    <td>${price.wasPrice}</td>
    <td class="center"><span class="green"><#if price.active><i class="fa fa-check"></i></#if></span></td>
    <td>
        <a class="btn btn-xs btn-default" href="/admin/products/new/${product.id}/prices/edit/${price.id}"><i class="fa fa-edit"></i> <@spring.messageText "button.edit" "button.edit" /></a>

        <form class="inline" action="/admin/products/new/${product.id}/prices/delete/${price.id}" method="post">
            <@forms.csrf />
            <@forms.hiddenInput path="price.id" />

            <button class="btn btn-default btn-xs" type="submit">
                <i class="fa fa-trash-o"></i> <@spring.messageText "button.delete" "button.delete" />
            </button>
        </form>
    </td>
</tr>
</#list>

0 个答案:

没有答案