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 6010343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:06:09+00:00 2026-05-23T02:06:09+00:00

I’m trying to write a backup dashboard showing the status of multiple servers backup.

  • 0

I’m trying to write a backup dashboard showing the status of multiple servers backup. The idea is to show a table with JSP that has the last few days dates in the columns and server names in rows. In this poor man’s table I wrote Yes/No values.

+------------+------------+------------+------------+
+ Host Name  | 2011-06-10 | 2011-06-09 | 2011-06-08 |
+------------+------------+------------+------------+
| web01      |     Y      |      Y     |     N      |
+------------+------------+------------+------------+
| web02      |     Y      |      Y     |     Y      |
+------------+------------+------------+------------+

Each server, does its own backup and saves the status into Amazon SimpleDb and I wrote a Java method to retrieve this information of the last few days with the following signature:

/**
 * List MySQL backups of the last howManyDays days. It starts from today 
 * included at index 0 and goes back in the past until we have a list of 
 * howManyDays days, even if some day doesn't have any data. Return a list of 
 * dates, each of which contains a list of backup jobs executed by servers in 
 * that day.
 * 
 * @param howManyDays
 *         how many days of backup to show
 * @return a Map where each key is the date in ISO format (2011-06-10) and each
 *         element is a backupJob which is represented by a Map where the key is 
 *         the server name (ex. web01, web01) and the value is "Y" if all was 
 *         fine, otherwise it contains the error message.
 */
public Multimap<String, Map<String, String>> listMysqlBackups(int howManyDays);

Multimap is the Google Guava Multimap because I’ve multiple backups per day. Example output:

{2011-06-10=[{web06=Y}, {web05=Y}], 2011-06-08=[{web05=Y}, {web06=Y}], 
 2011-06-09=[{web05=Y}, {web06=Y}], 2011-06-07=[{web05=Y}, {web06=Y}]} 

I don’t know how to consume this information in JSP. I tried with foreach:

<c:forEach items="${backups}" var="backup" varStatus="backupId">
    ${backup.key}
</c:forEach>

And the answer was:

javax.servlet.ServletException: javax.servlet.jsp.JspTagException: Don't know 
how to iterate over supplied "items" in <forEach>

Now I’m thinking if I’m shooting myself in the foot with a too complex return value and whether I should instead return a simple ArrayList of HashMap where each HashMap contains all the needed info (date, hostname, message). If you guys think is a better approach I don’t have any problems to rewrite the Java method extracting the data, but each cell will now require to loop across all the ArrayList to get the element (which could be ok because 6 servers by 7 days is only 42 elements).

How would you approach this problem?

  • 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-05-23T02:06:10+00:00Added an answer on May 23, 2026 at 2:06 am

    The JSTL forEach tag does not support Multimaps. It can only iterate over standard collections / maps / arrays.

    When I need to iterate over a Multimap in a JSP, I use its asMap() view. This lets me use forEach, since it knows how to iterate over the Map interface.

    It would look like the following:

    public Multimap<String, Map<String, String>> listMysqlBackups(int howManyDays) {
        // ...
    }
    
    public Map<String, Collection<Map<String, String>>> getListMysqlBackupsAsMap() {
        return listMysqlBackups(this.numberOfDays).asMap();
    }
    
    
    <c:forEach var="backup" items="${bean.listMysqlBackupsAsMap}">
        <c:set var="dateISO" value="${backup.key}/>
        <c:set var="backupJobs" value="${backup.value}/> <!-- a Collection<Map<String,String>> -->
        <c:forEach var="backupJob" items="${backupJobs}">
            <!-- do something with each backup job (Map<String, String>) for the current date -->
        </c:forEach>
    </c:forEach>
    

    If you can use JSP EL 2.1, you do not need the additional getter. You can simply call asMap() inside the JSP to obtain the Map view.


    All this being said, I’m not sure your use of a Multimap really does what you want here. A Multimap<String, Map<String, String>> maps each key to a collection of Map<String,String>.
    In your case, it means that you have:

    2011-06-09
        --> Collection
            --> Map<String, String>
            --> Map<String, String>
            --> Map<String, String>
    2011-06-10
        --> Collection
            --> Map<String, String>
            --> Map<String, String>
            --> Map<String, String>
    

    I’m not sure that’s what you want here. I think you want a Map<String, Map<String, String>>.

    Another solution would be to use Guava’s Table.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Basically, what I'm trying to create is a page of div tags, each has
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into

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.