This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes JSP, Solr - How to get fields from an Interator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "JSP, Solr - How to get fields from an Interator" Watch "JSP, Solr - How to get fields from an Interator" New topic

JSP, Solr - How to get fields from an Interator

willie wright

Joined: Feb 18, 2010
Posts: 6

I am new to Java (though not to JavaScript or JQuery). I have a standalone JSP that gets results from Solr. In the iterator, how can I break out the fields so I can display them similar to this:

<div>ItemID: <%=result.getItemID()%></div>
<div>ItemName: <%=result.getItemName()%></div>
<div>ItemImage: <%=result.getItemImage()%></div>
<div>CategoryID: <%=result.getCategoryID()%></div>
<div>CategoryName: <%=result.getCategoryName()%></div>
<div>ParentCategoryID: <%=result.getParentCategoryID()%></div>

Here's the code:

Here's the current output:

Searching Data on the Solr Index
Returned QueryResponse Header

Search Results Metadata

* Elapsed Time:0
* Query Time:0
* Number Of Results:583


* cgynam
o Clearance(68)
o New For 2009(57)


* SolrDocument[{itmnam=Widget 1, cgyid=1000, cgynam=Classic}]
* SolrDocument[{itmnam=Widget 2, cgyid=1000, cgynam=Clearance}]
* SolrDocument[{itmnam=Widget 3, cgyid=1000, cgynam=Clearance}]
* SolrDocument[{itmnam=Widget 4, cgyid=1000, cgynam=Clearance}]
* SolrDocument[{itmnam=Widget 5, cgyid=1000, cgynam=Clearance}]
Ninad Kulkarni
Ranch Hand

Joined: Aug 31, 2007
Posts: 787

UseCodeTags because it will be easier to read code.

SCJP 5.0 - JavaRanch FAQ - Java Beginners FAQ - SCJP FAQ - SCJP Mock Tests - Tutorial - JavaSE7 - JavaEE6 -Generics FAQ - JLS - JVM Spec - Java FAQs - Smart Questions
Don't get me started about those stupid light bulbs.
subject: JSP, Solr - How to get fields from an Interator
Similar Threads
ClassCastException while reading ics file with ical4j in JackRabit
HTML drop downs not working
request.getParameter retuning null
How far can you take HttpURLConnection
Struts Taglibs issues while including html in jsp