• 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

values aren't displaying from database

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using primeface in this project. I have a database with orders, order details and customers. The index page displays the order details and I click on one of the orders I want the customer details of that order to be displayed. But right now when I click on an order the dialog box that appears is empty. I'm not sure if the problem is with the jsf for the customer class.

here is the jsf page:


and the customer class:
 
Ranch Hand
Posts: 426
Eclipse IDE Fedora Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should integrate logging into your application, which can be turned on or off at runtime, or set to different Logger level, depending on what you want to see. For example, you should output to log the result set from your ResultSet rs = stmt.executeQuery("Select * from customers"); call. At this point, you do not know if you are getting any rows returned at all, or if there is an SQLErrorCode.
 
Karen Wilson
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes the query select * from customers works, i was able to display the customer information on a different page. so problem must be with jsf code

what is the difference between value and target? I have them set to the same thing. Could that be a problem?

 
Roger Sterling
Ranch Hand
Posts: 426
Eclipse IDE Fedora Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Karen Wilson wrote:yes the query select * from customers works, i was able to display the customer information on a different page. so problem must be with jsf code

what is the difference between value and target? I have them set to the same thing. Could that be a problem?



Logging the database call was just one example. You would also log the returns from all the rs.getStrings and new Customers etc. BTW - you'll notice substantial memory leaks if you leave the code like this. If you don't like logging, try the debugger.
 
Saloon Keeper
Posts: 27763
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
Dialog boxes in JSF are constructed - and initialized - as invisible objects when the page is first rendered. To populate them with data for a specific row edit, you need an AJAX method that will update the properties of your orderDialog bean with the values that you want to edit as part of the "show()" logic. The exact sequence, then is:

1. Call AJAX listener action method on click of the editing button
2. . Determine the row that you want the dialog to edit (you can use the currentRow DataModel method to get that easily).
3. . Copy the data row values to the orderDialog bean (Model)
4. . Return from the AJAX listener
5. render the updated dialog based on the updated Model
6. show the actual dialog UI

 
Karen Wilson
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not updating anything in the database. I just want to display the customer details from the order that was selected.
I know the problem isn't with the sql query because i tested that in the sql manager and it worked so problem is in jsf page
 
reply
    Bookmark Topic Watch Topic
  • New Topic