CRUD List View page to display field values referred by foreign keys

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

CRUD List View page to display field values referred by foreign keys

gunitinug
I have database phonerecord with the tables:


Code:

phonecalldb
-----------

phonerecord table
-----------------
phcallID primary key
whocalled
[whocompany]->clients.clientID
[staffanswered]->staff.staffID
notes

clients table
-------------
clientID primary key
clientName

staff table
-----------
staffID primary key
staffName




I generated a simple CRUD application using:
https://netbeans.org/kb/docs/web/jsf20-crud.html

Refer to this image:
https://imgur.com/a/JFdZN

I want in the List view whocompany to display clientName and staffanswered to display staffName. I think I could create a query for this but I don't know how. Thanks.[/img]




Attachments:
http://forums.netbeans.org//files/list_capture_120.png

Reply | Threaded
Open this post in threaded view
|

CRUD List View page to display field values referred by foreign keys

gunitinug
I kinda fixed it by

View.xhtml

Code:

<h:selectOneMenu id="whocompany" value="#{phonerecordController.selected.whocompany}" title="#{bundle.ViewPhonerecordTitle_whocompany}" >
                        <f:selectItems value="#{clientsController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>




List.xhtml

Code:

<f:facet name="header">
                                <h:outputText value="#{bundle.ListPhonerecordTitle_whocompany}"/>
                            </f:facet>
                            <!--<h:outputText value="#{item.whocompany}"/>-->
                            <h:selectOneMenu id="whocompany" value="#{phonerecordController.selected.whocompany}" title="#{bundle.ViewPhonerecordTitle_whocompany}" >
                                <f:selectItems value="#{clientsController.itemsAvailableSelectOne}"/>
                            </h:selectOneMenu>