JSTL iterate array

J

Jon Rasmussen

I have got a bean Role:

public class Role implements Serializable {
private String name;
private String notes;

public Role() {
super();
}

public String getName() {
return name;
}
public String getNotes() {
return notes;
}
}

In my command I have got Role[] roles that I put in the http session before
forwarding to the JSP page.
In the the JSP I want to iterate through the array of Roles.

How can I do that using the core JSTL libs?

Thanks,

Jon Rasmussen
 
J

John Fereira

I have got a bean Role:

public class Role implements Serializable {
private String name;
private String notes;

public Role() {
super();
}

public String getName() {
return name;
}
public String getNotes() {
return notes;
}
}

In my command I have got Role[] roles that I put in the http session
before forwarding to the JSP page.
In the the JSP I want to iterate through the array of Roles.

How can I do that using the core JSTL libs?

Assuming the session variable is called "roles"

<c:forEach var="role" items="${roles}">
Name: <c:eek:ut value='${role.name}'/><br>
Notes: <c:eek:ut value='${role.notes}'/>
</c:forEach>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top