• 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

Can I get code for 'CTRL F'

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am developing a Java web application.
In all its view page it should have a search button to search the specific object in that particular page only.
It should something work like Ctrl F .
Can any body help me out with the code.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

What effect would that search functionality have? How would it be different from using the browser's search function?
 
natam holla
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take for an example....
It will have a web page containing 1000 country names.
In the top right side of the page, it should have a text box with a search button.
It should be validated such that, before entering any letter or word in the Search text box, the search button should be blur.
But once you type a single word in the Search text box, it should be activated.Ex:Type 'Tokyo' , in text box.
If its present, it should be highlighted with some color(where all present.)..if not message ' no such string/letter present'...should arrive.


Can you help me out....
 
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
Isn't that pretty much what the browser's search function does? I don't understand the point about "validation", though.
 
natam holla
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, its the same.....
You help me out with that code only...
You don't worry about validation.
 
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
If it is the same as what the browser does, then why is it even needed?
 
natam holla
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my web application. I am not supposed to use browser functionality.
So i need code for this....
Please help me out...

Thanks in advance....
 
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

In my web application. I am not supposed to use browser functionality.


You're not - the user is using the browser like it was intended to. If there's no further reasoning than this behind this requirement, then I'd advise to question it.
 
natam holla
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In all the view pages there should be a search button to search the specific object........This is the requirement.
Did you get my point....
Will you help me out.
 
Ranch Foreman
Posts: 275
jQuery Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you have to do it... maybe source code of a browser helps.
But I agree with Ulf on the design.
 
Aniruddh Joshi
Ranch Foreman
Posts: 275
jQuery Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can also integrate google search in your website.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

natam holla wrote:In all the view pages there should be a search button to search the specific object........This is the requirement.
Did you get my point....
Will you help me out.



Seems like a lot of work to replicate functionality that is already there. I'm with Ulf, I'd ask why this were needed first. Writing something that searches the current DOM in JavaScript is easy enough, but that would be seperate of the browsers own search capabilities.
 
natam holla
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I need the code.....please
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Calling browser specific functionality from a web page is pretty much a non-starter - I can't think of any way to call the functionality of the Edit>Find menu without using something like ActiveX in IE for example. Repeating this functionality in JavaScript is easy enough to do. Google for JavaScript search in page and you will get a whole bunch of examples.
 
natam holla
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Paul!!!
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want to impliment anythin on search then you will not have to do much work in database query.

In java code following things you need to do.

1) put a button or image of searching and call a javascript function on click on that.
2) Write a function in java script, Do all validations in it, after validation pass value of search txt box to java code.
3) append search criteria in where clause of your select query (a query which gives you results at first time when you open the page) and return all selected records to JSP page.

if you want code then you have to give more detail like which architecture you are folloing, then which type of search you want.

Like you want to give searching on perticular field in jsp
E.G say JSP displays detail of person then search name field, or search in surname field etc.

I had already developed such functionality in MVC structure.

Hope this will help you.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic