Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/363.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 为一对多关系播放2.2 scala视图_Java_Scala_Playframework - Fatal编程技术网

Java 为一对多关系播放2.2 scala视图

Java 为一对多关系播放2.2 scala视图,java,scala,playframework,Java,Scala,Playframework,我试图在提交操作的Play框架中同时保存一对多关系。表示同时保存客户和地址 这种关系是一个客户对多个地址的关系 在视图中,我希望地址scala可重用,因此我声明了addressTemplate.scala.html,如下所示 @(addressField: Field)(title: String) <h5>@title</h5> @inputText( addressField("addr

我试图在提交操作的Play框架中同时保存一对多关系。表示同时保存客户和地址

这种关系是一个客户对多个地址的关系

在视图中,我希望地址scala可重用,因此我声明了addressTemplate.scala.html,如下所示

    @(addressField: Field)(title: String)
        <h5>@title</h5>

            @inputText(
                addressField("address1"), 
                '_label -> "Address1"
            )     
    ....

    Now, my Parent scala view customer.scala.html is like below. it creates blank form on GET customer action.

    @(customerForm: Form[Customer])        
      @form(routes.CustomerContoller.submit()) {                
                @inputText(
                    partnerForm("firstname"), 
                    '_label -> "First name"
                )
                ....                
          @for(address <- customerForm("addresses")) {
                 @addressTemplate(address)("Billing Address")
          }                     

I know, the for loop just above is not correct, and not compiling, that's where I need experts help.
Question is: how to design the view to support Customer multiple Addresses. The AddressTemplate takes Field as parameter, I need get the address/addressForm and pass, not sure how to get the ChildForm. Hope the question is clear, if not please let me know. 

Models
======
Btw, the Model relationship are like below.

public class Customer extends BaseModel {
    ...
    @OneToMany(cascade = CascadeType.PERSIST)
    public List<Address> addresses;
@(地址字段:字段)(标题:字符串)
@头衔
@输入文本(
地址字段(“地址1”),
“\u标签->地址1”
)     
....
现在,我的父级scala view customer.scala.html如下所示。它在获取客户操作时创建空白表单。
@(CustomerPerform:表单[客户])
@表单(routes.CustomerContoller.submit()){
@输入文本(
partnerForm(“名字”),
“\u标签->“名字”
)
....                

@(地址的标题应该是“五月-十二月的关系”吗?在我看来,他们还可以,但我是一个老人。谢谢abronan,更正了标题。