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

  • SEARCH
  • Home
  • 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 8110679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:50:27+00:00 2026-06-06T01:50:27+00:00

I have to be able to store data in a new object, that I

  • 0

I have to be able to store data in a new object, that I am getting from a complex object where each item is held in a List.

The hierarchy is the following:

bookId 
pageId
wordId
  • bookId is unique and can have zero to many pageId's
  • pageId can have zero to many wordId's

I have the data, but I need to cycle through each item and put into an object – ArrayList or similar – so I can pass off to another class, which is expecting a List. In the next class, the data is to be presented in a jsp table.

Can someone please help the best way to do this. Do I need ArrayList or ArrayLists, or is there a simple way to do it?

  • 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-06T01:50:29+00:00Added an answer on June 6, 2026 at 1:50 am

    Simple way of organizing this structure is following:

    class Book {
      int bookId;
      ArrayList<Page> pages;
    }
    
    class Page {
      int pageId;
      ArrayList<Word> words;
    }
    
    class Word {
      int wordId;
    }
    

    Each your entity is an object. For example Create simple book you can with next code:

    Book book = new Book(); // create Book object
      ArrayList<Page> pages = new ArrayList<Page>;
      pages.add(new Page()); // add first page
      pages.add(new Page()); // add next page
    book.setPages(pages); // set reference to pages for book
    

    Note that you need provide appropriate constructors and setters/getters to operate with that code.

    For presenting this data on jsp, you can use bean object Book, and with jstl you can get access to any field from book (includes each page and each word in a page) that you need.

    Actually, there are lot of more complex structures but its usage depends on your requirements. I think, this model is fit for simple cases.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to be able to store data in a new object, that I
I have classes that store data, and methods to go get data for individual
I have a tabel containing a column named parent which is able to store
I want to be able to have a Stored Procedure that can only be
I have been able to find lots of examples of adding a Dropdown list
I have been able to design my layout so that it has 2 columns
I am creating an object server-side which is to have all of the data
I need to utilize the Cache object in ASP.NET to store some data with
I have a desktop (winforms) application that uses a Firebird database as a data
So I am working on an app that uses core data to store attributes

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.