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 Beginning Java and the fly likes Keyword search 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 » Java » Beginning Java
Bookmark "Keyword search" Watch "Keyword search" New topic
Author

Keyword search

jasmine dyaga
Greenhorn

Joined: Apr 11, 2012
Posts: 8
Hi ,

When i give my item no:8415-00-051-1173 in search bar it displays item details of that particular product.

But i need to get same results when i give without hypens i.e 8415000511173 .

Can anyone guide me to get this result

Thanks,
Jasmine
William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 860

If the format is exactly the same, i.e: nnnn-nn-nnn-nnnn then simply rebuild the string using subString() and concatenation.

WP
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

Please BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/javaserver-pages-jsp-jstl/58102-keyword-search.html


luck, db
There are no new questions, but there may be new answers.
jasmine dyaga
Greenhorn

Joined: Apr 11, 2012
Posts: 8
Hi ,

I used substring and conactenation.



But it is displaying the same results.When i give without "-",it is not displaying the results
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

jasmine password wrote:I used substring and conactenation.


No, you didn't. Everything you posted there is a comment, not executable code. (I added the code tags to your post to make it more readable. It would be good if you did that yourself in the future.)
Saurabh Pillai
Ranch Hand

Joined: Sep 12, 2008
Posts: 506
jasmine password wrote:Hi ,

When i give my item no:8415-00-051-1173 in search bar it displays item details of that particular product.

But i need to get same results when i give without hypens i.e 8415000511173 .

Can anyone guide me to get this result

Thanks,
Jasmine


How do you store item no in database? If it is stored WITH hyphen,

1) If search string is WITHOUT hyphen (eg. 8415000511173) then you need to format your database field, which stores item #, to remove hyphen while comparing in database query. OR if item # has FIXED format of 4-2-3-4 then better way is to format the search string in predefined format and then query database normally.

2) The other case, WITH hyphen is already working.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Keyword search
 
Similar Threads
JComboBox show just one line.
Null Pointer in struts
how to reset a selected list box item after search
Entitymanager.refresh doubt
EJB 3 IN ACTION - EntityManager merge() and refresh() method conflict