Time for action – setting a default salary for employees

For example, consider a case wherein we want to set a default value for the salary attribute in the EmpEO.xml file based on the Deptno attribute. In this case, we have to provide an expression that will be evaluated at runtime to provide the default value. The following steps show us how to do this:

  1. Click on the Sal attribute from the list of attributes displayed in the Attributes section of EmpEO.xml.
  2. In the Default Value section, select the Expression option. Now the pencil icon will be enabled for the textbox below the Expression option.
  3. Click on the pencil icon to open an Edit Expression Editor window, and add the following code in the Expression editor box:
    if(Job == 'MANAGER'){ Sal = ...

Get Oracle ADF 11gR2 Development Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.