Sunday, December 17, 2006

Dropdown list in each row (J2EE track)

If someone wants to implement dropdown list in each row of the table, and he is using ADF BC in Model layer, there is no problem - just use ADF screencast available in Steve Muench blog. But, if TopLink and EJB are used in Model layer, then implementation will be little bit different. Below I describe how to implement this using TopLink and EJB.

Let us use standard HR schema entities - Employees and Departments. The main trick is to add getter and setter methods into Employees entity bean for the departmentId (this will enable us to use departmentId in Employees entity). Below are main steps you need to follow when developing View layer:
  1. In the page definition file define methodAction for findAllDepartments. Define a methodIterator binded to findAllDepartments method definition and a table with two items - departmentId and departmentName
  2. Create af:selectOneChoice in af:column component as it is described in Steve Muench screencast
So, the main differences are to modify entity bean and to define some additional elements in page definition file.

Sample application - SelectOneChoice.zip.

6 comments:

  1. This was precisely the example I was looking for.
    However instead of using forEach I only created a methodIterator for departments and then dropped deptId column from data control as a selectOneChoice. In the dialog that comes up I mapped deptId of base table with deptId of departmentIterator. But for some reason it does not show department name of current deptId in the row. Infact It shows blank value as if no Id has matched.

    what might be the reason for that? Please guide

    ReplyDelete
  2. Hi,

    I didnt used wizard when developing this sample. Its better to follow steps described in Steve Muench screencast and apply my hint to make it work with TopLink case.

    Regards,
    Andrejus

    ReplyDelete
  3. Not able download the sample ..please can you send me this sample

    ReplyDelete
  4. Hi,

    Cant download exmple!
    Could you please send me?


    Thanks & Regards,
    LZ

    ReplyDelete
  5. I am not able to download this sample zip. Can you please provide access to the old posts?

    ReplyDelete
  6. No, I don't have this app anymore - 10g ADF is too old. You should use 11g or 12c.

    Andrejus

    ReplyDelete