• Post Reply Bookmark Topic Watch Topic
  • New Topic

values aren't displaying from database  RSS feed

 
Karen Wilson
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • 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:
 
Roger Sterling
Ranch Hand
Posts: 426
Eclipse IDE Fedora Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!