Spring引导列表绑定 [英] Spring boot list binding

查看:96
本文介绍了Spring引导列表绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我试图在我的控制器中保存订单列表,但我有一个不同类型的订单,每种类型都有一些特定的条目我该怎么做。我在我的实体类继承类型中使用等于join

Hello every Body ,

I m trying to save a list of order in my controller but i had a different type of order and each type had some specific entries how can i do that .I m using in my entity class inheritance type equal to joined

("@Inheritance(strategy = InheritanceType.JOINED)")

。有没有人知道怎么做?



我尝试过的事情:



. Any body had an idea how to do that ?

What I have tried:

<form action="#" th:action="@{/order/save}" th:object="${form}"
  method="post">
    <fieldset>
        <input type="submit" id="submitButton" th:value="Save">
        <input type="reset" id="resetButton" name="reset" th:value="Reset"/>
        <table>
            <thead>
                <tr>
                    <th> Title</th>
                    <th> Author</th>
                </tr>
            </thead>
            <tbody>
                <tr th:each="order, itemStat : *{orders}">
                    <td><input th:field="*{orders[__${itemStat.index}__].title}" /></td>
                    <td><input th:field="*{orders[__${itemStat.index}__].author}" /></td>
                </tr>
            </tbody>
        </table>
    </fieldset>
</form>

推荐答案

{form}
method =post>
< fieldset>
< input type =submitid =submitButtonth:value =Save>
< input type =resetid =resetButtonname =resetth:value =重置/>
< table>
< thead>
< tr>
< th>标题< / th> ;
< th>作者< / th>
< / tr>
< / thead>
< tbody>
< tr th:每个=order,itemStat:* {orders}>
< td>< input th:field =* {orders [__
{form}" method="post"> <fieldset> <input type="submit" id="submitButton" th:value="Save"> <input type="reset" id="resetButton" name="reset" th:value="Reset"/> <table> <thead> <tr> <th> Title</th> <th> Author</th> </tr> </thead> <tbody> <tr th:each="order, itemStat : *{orders}"> <td><input th:field="*{orders[__


{itemStat.index} __] .title}/>< / td>
< td>< input th:field =* {orders [__
{itemStat.index}__].title}" /></td> <td><input th:field="*{orders[__


{itemStat.index } __]。author}/>< / td>
< / tr>
< / TBODY>
< / table>
< / fieldset>
< / form>
{itemStat.index}__].author}" /></td> </tr> </tbody> </table> </fieldset> </form>


这篇关于Spring引导列表绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆