• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF2 CRUD DataTable and SelectOneListBox Questions  RSS feed

Gm Miller
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hoping that someone can help me out with my problem:

I have a database that I use to track patients, surgeries, and any complications for purposes of self directed quality improvement. Patients table/entity has basic demographics on each patient and has a patient_id field that is linked, one to many to the Surgery table/entity. Surgery table/entity lists each surgical procedure performed, and has a patient_id field that has the Many to One annotation (thus bidirectional).

I used NetBeans 6.8 to create a basic CRUD web application (just selected the appropriate tables, created the entity classes, and then the JSF pages from entity classes, which created the session beans and the controller beans). Also, creates a list.xhtml page (among others) for each table/entity. On the Patients/List.xhtml page is a datatable that lists all patients. I would like to create a column that has a SelectOneListbox in it that shows any surgical procedures performed on that patient. Below is an excerpt from my patients/list.xhtml page:

<h:panelGroup rendered="#{patientsController.items.rowCount > 0}">

<h:dataTable value="#{patientsController.items}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">

<f:facet name="header">
<hutputText value="listbox"/>
<h:selectOneListbox id="dd" value="#{item.surgeryList}" size="1">
value="#{item.surgeryList}" var="invoiceCPTID"

When I compile and run the web app, the index.xhtml page appears, allowing me to choose the patients page, which appears and shows the first 100 patients in my MySQL db. The SelectOneListboxes also are in the column appropriately, with or without surgeries listed (correctly so). Problem is when I click on any URL Link (e.g., Next 100, or Edit,or View, or Destroy the selected row). Then I get a page that has multiple entries like the following:

Conversion Error setting value 'ZZZZZ00DL5' for 'null Converter'.

'ZZZZZ00DL5' is a SurgeryID. There are multiple listings for each of the surgery-IDs that are on the page, followed by the same first 100 patients. I've searched for this error on the web, and the suggested answers do not work.

My questions are:
1.) How can I make this work so that I can proceed to next page
2.) Many patients in my database have not had surgery, thus their SelectOneListbox is empty. I've tried to set the render=#{item.surgeryList.rowsAvailable}" or render="#{item.surgeryList.rowCount > 0}", but these don't work.

Thanks for any and all advice.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!