Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8430933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:43:13+00:00 2026-06-10T05:43:13+00:00

I am working on a project where I load objects into an ArrayList arrayDiary

  • 0

I am working on a project where I load objects into an ArrayList arrayDiary in my action class populate method. The page linking to this page has the URL ‘populateDiary.action’. I have public getters & setters for this arrayList and I can see that the populate method is called and the arrayList does actually contain values.

My problem is that when I try to populate a li using the STRUTS iterator tag I am not seeing anything on the screen. I have read several posts on this and as far as I can see have copied them exactly – however I am not seeing my results on the screen.
Heres my diary.jsp code:

<s:iterator value="arrayDiary" status="pos" id="res">
<li onclick="$('#eventList').toggleClass('eventList'); $('#eventDesc').toggleClass('eventDesc'); $('.active').toggleClass('active'); $(this).toggleClass('active');"><a href="#"><s:property value="#res.title"/></a></li>
</s:iterator>

Heres my action class code:

private ArrayList<DiaryEntry> arrayDiary;
private ArrayList<DiaryEntry> arrayEvent;

public String populate() {
    ArrayList<DiaryEntry> arrayEvent = new ArrayList<DiaryEntry>();
    ArrayList<DiaryEntry> arrayDiary = new ArrayList<DiaryEntry>();
    DiaryEntry load = new DiaryEntry();
    username = (String) ActionContext.getContext().getSession().get("username");
    loginId = (String) ActionContext.getContext().getSession().get("loginId");
    ArrayList<DiaryEntry> diaryEntry = load.loadDiaryEntry(username, loginId);
    for (DiaryEntry entry:diaryEntry) {
        if(entry.getEvent() == null) {
            arrayDiary.add(entry);
        }
        else {
            arrayEvent.add(entry);
        }
    }
    return "populate";
}

public ArrayList<DiaryEntry> getArrayDiary() {
    return arrayDiary;
}

public void setArrayDiary(ArrayList<DiaryEntry> arrayDiary) {
    this.arrayDiary = arrayDiary;
}

public ArrayList<DiaryEntry> getArrayEvent() {
    return arrayEvent;
}

public void setArrayEvent(ArrayList<DiaryEntry> arrayEvent) {
    this.arrayEvent = arrayEvent;
}

Heres my struts.xml:

<action name="*Diary" method="{1}" class="spirit.DiaryAction">
    <result name="populate">/diary.jsp</result>
    <result name="input">/diary.jsp</result>
    <result name="success">/diary.jsp</result>
</action>

I would really appreciate if someone can spot where i’ve gone wrong. I’ve been working on this issue for 2 days now with no success. Thanks in advance for your help and feedback.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:43:14+00:00Added an answer on June 10, 2026 at 5:43 am

    There is an obvious ERROR in your action class, you had arrayDiary and arrayEvent defined in your class and in your method populate(), there is for sure nothing happened in your <s:iterator>

    please change your method populate() like this:

    public String populate() {
        arrayEvent = new ArrayList<DiaryEntry>();
        arrayDiary = new ArrayList<DiaryEntry>();
        DiaryEntry load = new DiaryEntry();
        username = (String) ActionContext.getContext().getSession().get("username");
        loginId = (String) ActionContext.getContext().getSession().get("loginId");
        ArrayList<DiaryEntry> diaryEntry = load.loadDiaryEntry(username, loginId);
        for (DiaryEntry entry:diaryEntry) {
            if(entry.getEvent() == null) {
                arrayDiary.add(entry);
            }
            else {
                arrayEvent.add(entry);
            }
        }
        return "populate";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a small project which requires me to load images into
I am working with UIWebView project and I want to load an HTML file
i'm working on a project with a lot of images but after i load
I am working on project and ran into an issue. Now I want to
I am currently working on a project which has Employee, Manager entities. At the
So I'm working on a project for a realtor. I have the following objects/MySQL
We're working on a PHP project, which has been in development for more than
I have a working project that Im amending, it crashes after trying to use
I'm curious if it is possible to move the written and fully working project
While working a project tonight, I ended up using one .js resource file for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.