Can';t在play framework scala程序中获取id

Can';t在play framework scala程序中获取id,scala,playframework-2.0,Scala,Playframework 2.0,这是我的查看页面,这里没有获取id @(userprofiles: List[UserProfile], myFriend: models.MyFriend, userprofile: models.UserProfile) @helper.form(action = routes.Application.listMyFriend) { 值id不是列表[models.UserProfile]的成员 以下是发生错误的地方: @for(userprofile <- userprofi

这是我的查看页面,这里没有获取id

@(userprofiles: List[UserProfile], myFriend: models.MyFriend, userprofile: models.UserProfile)
@helper.form(action = routes.Application.listMyFriend) {
值id不是
列表[models.UserProfile]的成员

以下是发生错误的地方:

    @for(userprofile <- userprofiles.id) {
        @if(userprofile.id == userprofiles) {
        } else {
            <img src="@routes.Assets.at("images/img2.png")" width="200" height="200" />
            <br><h5>@userprofile.name</h5>
            <h6>@userprofile.gender</h6>
            <h6>@userprofile.date_of_birth</h6>
            <div class="actions">


            <input type="submit" class="btn primary" value="+1 Add As Friend" title="Send Friend Request"></div>
            <br/>
        }
    }
}
这就是路线:

POST /createMyFriend    controllers.Application.listMyFriend
GET  /allFriends        controllers.Application.listAllFriends(userId:Long)

错误消息会告诉您出了什么问题。您的
UserProfile
UserProfile
的列表。它没有名为
id
的成员。但是,您正在尝试访问它:

@for(userprofile <- userprofiles.id)
//                              ^--- this is invalid

@for(userprofile错误消息会告诉您出了什么问题。您的
userprofiles
userprofile
的列表。它没有名为
id
的成员。但是,您正在尝试访问它:

@for(userprofile <- userprofiles.id)
//                              ^--- this is invalid

@for(userprofile我将其更改为但id为get但if语句出错@for(userprofile我将其更改为但id为get但if语句出错@for)(userprofile
@for(up <- userprofiles){
  @if(up.id == userprofile.id) {} else { ... }
}