JSTL: Accessing an encapsulated object array

Posted on 2006-05-11
Last Modified: 2013-11-24
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()

   public void setName(String 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 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!

Question by:ronandersen
    LVL 92

    Accepted Solution

    does Parent have a getAlbum() method?

    Author Comment

    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??

    Author Comment

    Answered..created a public getAlbum() method in Parent class and accessed via JSTL for loop.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Suggested Solutions

    This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
    Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
    The viewer will learn how to implement Singleton Design Pattern in Java.
    This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now