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

using Lucene/servlets/jsps

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is anyone here familiar with lucene/servlets/jsps?

if so, i need some guidance. i have successfully indexed content and have a servlet that searches through a lucene index and returns hit documents in a table format via a jsp. the hit documents contain highlighted content so that the users eye can quickly jump to the keyword specified. is it possible to pass the highlighted term to another jsp? or does the jsp have to have access to the lucene attribute (for example: session.setAttribute("searchResult", searchResult); ) via the search servlet?

i hope this makes sense. any help is greatly appreciated!
 
Saloon Keeper
Posts: 5802
146
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think I understand the problem. If the search results are in the session, then any servlet or JSP can get at it. But yes, it needs to be stored somewhere in order for other parts of the web app to access it.
 
Nicole Jones
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim.

Lets say, for instance, I enter a keyword. The servlet returns the results in a table format with the keyword highlighted (in this case, a title). I click on the highlighted title, which takes me to a detail page (JSP). i want the detail page to display the highlighted keyword within the title. does the search session have to be forwarded to that detail page? or can i simply access it like so ${result.title} without having to forward the search session to the detail page?

Tim Moores wrote:I don't think I understand the problem. If the search results are in the session, then any servlet or JSP can get at it. But yes, it needs to be stored somewhere in order for other parts of the web app to access it.

 
Tim Moores
Saloon Keeper
Posts: 5802
146
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you're confused about terminology - a session is not "forwarded". While I think I know what you mean, it needs to be said that "forwarding" has a specific meaning in the servlet/JSP context, and it's not what you're talking about.

In order to be able to access ${result.title} in a JSP, "result" needs to be set as an attribute in some context accessible to a JSP - that can be the web app context, it can be the session, it can be the request, or it can be the page. Doesn't matter which one, as the JSP will look in all those contexts. (And when I say "doesn't matter", I'm not saying that all contexts are equal - they're not. I'm just saying that the JSP will look in all of them in order to find that attribute.)

But as I said before - it doesn't happen automatically, you need to set that object as an attribute in one of those contexts.
 
What are you doing? You are supposed to be reading this 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!