I have a class named Language
with 1 field named name
. I have another class named Speech
which has a language
member. I need to iterate over a list of Speech
objects. In JSTL:
<c:forEach items="${requestScope.Speech}" var="speech">
<tr>
<td> ${speech.id}</td>
<td> ${speech.language.name}</td>
</tr>
</c:forEach>
My second statement ${speech.language.name}
doesn't work. How can I make it work?
Speech and Language classes:
public class Speech {
private int id;
private Language language=null;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Language getLanguage() {
return language;
}
public void setLanguage(Language language) {
this.language = language;
}
}
public class Language {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}