• 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

searching data

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
may i know how to do a searching for data in jsf?
 
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Usually a JSF page is backed by a managed bean. You request data through Expression Language (EL) expressions, like:



The managed bean would probably be called MyBean.java, though you can call it anything you want. It would have a getter method, getUnitsSold(), and in there you'd retrieve the data any way that you normally retrieve data in Java ... read it from a file, a direct JDBC call to a database, call to an EJB, load it through Hibernate, etc. It's a good idea for the getter to just load data once and hold onto it for the scope of the bean, or at least the request. JSFs tend to call the getters over and over, and you don't want to keep loading the same data.
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Wa!

JSF does not directly support data searches or database interfacing. Its primary purpose is to manage the UI, where it transfers data to and from the client viewer (web browser) using the Model/View/Controller paradigm and initiates actions based on UI operations. The action processing itself is standard application logic and can be whatever you want.
 
wa nor
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
did you have any example of coding related on how to search data from database?
basically, my problem is how to read/scan text that user paste in textarea then how can i match the data that user paste in textarea with existing data in database?
really need your help ..
 
Tim Holloway
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JSF will handle getting the text area data into a backing bean and it will invoke an action method when the form is submitted.

The actual database lookup code is up to you. If you need help on that, we have database forums. If you are looking for a free-form text search, the popular choice is Apache Lucene. It's what the CodeRanch uses.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic