Acceder aux attributs d'un objet dans un template
Bonjour,
je teste le framework play 2.0.1 et je rencontre un problème dans le template scala.
Voici les sources concernées :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| @for(post <- posts) {
<div class="container">
<div class="span2">
<img src="@post.author.profilePicture" alt="@post.author.name">
</div>
<div class="span6">
<p>@post.author.name
<p>@post.text
<h5>@post.dateOfPost</h5>
</div>
</div>
} |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
@Entity
public class Post extends Model {
@Id
public long id;
@Required
@ManyToOne
public User author;
@Required
public String text;
@Required
public Date dateOfPost;
...
} |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
@Entity
public class User extends Model {
@Id
public long id;
@Required
public String name;
@Required
public String email;
@Required
public String password;
@OneToMany
public List<Post> posts;
public String profilePicture;
...
} |
dans le template, post.author.name et post.author.profile picture ne renvoient rien. J'ai pourtant testé côté serveur et les valeurs existent bel et bien.
Quelqu'un aurait une idée d'où pourrait venir le bug ?
Merci d'avance.