I'm writing a servlet and a JSP. The servlet will query a Lucene index and retrieve an object of type SolrDocument (documented here.) My goal is to have the JSP iterate over the fields of the object and display them. Here's a Java class that displays a few fields of the object. The code works but it's doing the printing that I can't figure out how to get the JSP to do:
Note that while resultId and title are strings, authors is an array list. If it's easier for the JSP I can have the servlet concatenate the authors field list elements into a single string.
I've read about the JSTL <c:forEach> tag but it iterates over arrays and collections.
What do I pass to the JSP and how would the JSP iterate over the fields of what I pass it?