• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Search fuction in JSP

 
Ranch Hand
Posts: 86
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, i have to build a search fuction in my website. In main page(JSP) i have a text field and a submit button. When button clicked, user should transfer to goods list (JSP) where all my goods retrieved from store(XML). I have stuck at the point where only goods with name similar to the keyword should be displyed. (ex. If user insert "to" in main page, goods list page should present "Tomatoes" and "Toaster" or if insert "apples" only "Apples")

Any help???
Thank you
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where is the data stored? If it's in a DB, then SQL covers this case (read up on the LIKE operator and the LOWERCASE/UPPERCASE functions). If the data is in files, then using a library like Lucene may help.
 
Pan Niko
Ranch Hand
Posts: 86
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As i said, i have a xml file and stored all my datas there. Sorry but im a lil bit fresh, what is Lucene library
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see, I misinterpreted the mention of XML. You can use one of the XML APIs (maybe SAX or DOM; and possibly XPath) to iterate through all goods and perform some appropriate string operations to do the comparison. Something like nameOfGood.toLowerCase().indexOf(userInput.toLowerCase()) != -1.

As to Lucene, a web search will find its home page (which has extensive documentation) quickly; it's not like that's a common word.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic