[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 216
  • Last Modified:

JSTL: Accessing an encapsulated object array

I have a array object encapsulated within another object

1) Class Parent {
  private Album album = new Album[2];


2) Class Album {

   private String name;

   public String getName()
      return this.name

   public void setName(String name)
      this.name= name


3) Inside Java Exe..
Parent parent = new Parent();
request.setAttribute("parent ", parent );

4) JSP
<c:forEach var="image" items="${parent.album}" varStatus="itemStatus" begin="0" step="1">
    <c:out value="${itemStatus.count}" />

This does not work..it has a problem accesing the object array

5) It works if I save the object in the Request as an array:

Inside Java Exe..
Parent parent = new Parent();
request.setAttribute("album", parent .album);

This works!

  • 2
1 Solution
does Parent have a getAlbum() method?
ronandersenAuthor Commented:
You answers are not clear on the specific steps to close this question. I assume this question is closed, since it was answered. Therefore, what are you asking me to do??
ronandersenAuthor Commented:
Answered..created a public getAlbum() method in Parent class and accessed via JSTL for loop.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now