This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

JSP, Solr - How to get fields from an Interator

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

{status=0,QTime=0,params={facet=true,facet.mincount=1,start=0,q=widget,facet.field=cgynam,wt=javabin,rows=5,version=1}}
Search Results Metadata

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

Facets

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


Results

* 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}]
 
Ranch Hand
Posts: 811
Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
UseCodeTags because it will be easier to read code.
 
The knights of nee want a shrubbery. And a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!