File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help accessing data in a List of Maps

 
Liana Daughtry
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been working on something for hours and I hope someone can help. I have a List of Map objects that I am trying to access in my JSP. I am using Struts. The List defined in my Action class looks like this:

List<Map<String, String>> errmsgArr
request.setAttribute("errmsgArr", errmsgArr);

Nothing I have tried is working. I wanted to populate a table, but I have finally given up and stripped the code down to what follows. I just wanted to see if I could access the table, so I coded the following in my JSP:



According to different examples I found the code should work, but my HTML page shows up blank. What am I missing?
By the way, I displayed the data in the table before I issued the retun, so I know there is data in the table.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The HTML is blank, or the page is blank? These are not the same things. Is anything being sent to the browser?

Have you used fn:length() to check the size of the list and maps when they get to the JSP?

 
Liana Daughtry
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I found the error of my ways. I displayed the contents of the list in a class called by my action (as opposed to displaying right before issuing the return). For whatever reason I returned null back to the action instead of the List. Now that the mystery is solved, I am wondering how to accomplish what I really need to accomplish. I get the following results when I execute the jsp in my original question:

messageId 02c54758b
claim 123456
code 040
node Blue
id TEST999999999
messageId 02c54758c
claim 123789
code 040
node Blue
id TEST99999999

The keys can vary from request to request because the user can select which fields to display on the report. So, I would like the column headers to be based on the the key fields and the rows to be based on the values. The output should look like:

messageId claim code node id
02c54758b 123456 040 Blue TEST999999999
02c54758c 123789 040 Blue TEST999999999

Any advice on the best way to make the above happen?
 
Liana Daughtry
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Someone sent me the solution I was looking for, so I am posting it just in case someone else has the same question.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic