wesley
wesley

Reputation: 137

Access list using jstl in jsp

I hava a Course object and in that object there is an attribute List with Skill objects (A course has many Skills).

Now I need to access that skills variable in my .jsp page using jstl. I am able to iterate over the courses, but what I want is to also iterate over every skill from the skills attribute. Something like:

<c:forEach var="course" items="${courses}">
  <c:forEach var="skill" items="${course.skill}">
    //print skill id: ${skill.skillId}
  </c:forEach>
</c:forEach>

Only this doesn't work. Can this be solved?

Upvotes: 0

Views: 502

Answers (1)

Ashim
Ashim

Reputation: 473

The syntax of your code is all correct. So, make sure you have a getSkillId() method in Skill class and data in your corresponding table. Also, try removing the comment, i don't think that's a correct way of commenting in a jsp page.

Upvotes: 1

Related Questions