Default Display Value - ADF JHeadstart icing on the cake americas cup win 2682133k1

Default Display Value – ADF JHeadstart icing on the cake

If you want to set default values for ViewObject Attributes in new records, you can now very easily do so when your application makes use of the ADF JHeadstart runtime framework. This makes it very easy to for example automatically set the current date or the department of the current user as context on the newly created record. Also the work of end-users can be simplified if the most frequently occuring value is pre-set. Note that you can easily dynamically derive the default values to use; you can specify user preferences, make them available through the user object and set default values based on these user preferences. Note that this functionality that does not currently exist in JHeadstart 9.0.5.x; it is something I have asked for quite some time now. I am really pleased with this implementation!

The property Default Display Value (internally the DEFAULT_VALUE property) in the VO or EO Attribute can be used to define a default display value. This property can hold a literal value, or an EL expression which is then calculated by the Evaluator class. To get the current date as default value, you can use the $CURRENT_DATE$ as value of the DEFAULT_VALUE property. The expression used for a Default Value can be an EL that looks to bindings, sessionscope etc. For example: ${sessionScope.jhsUser.dptId} or ${sessionScope.jhsUser.preferences.language}.

No generation is needed after changing the DEFAULT_VALUE property: it is a runtime setting! Note that there must be a binding for the Attribute in the PageUI Model for the current page. The attribute does not need to be displayed, it can be hidden and perhaps it does not have to be in the page at all – as long as the binding exists.

Question: what if we have set default values, for example in a new row, and we do not actually want to create a new row: will ADF JHeadstart recognize we did not actually make any changes and therefore should not commit the row?
Answer: Yes, JHeadstart is smart enough to check the values in the submitted row against the default values; if only default values are submitted, the record is regarded as unchanged/not to be inserted. Note: when the default value expression refers to a property that was changed ever since the new row was prepared to be displayed on the page, the record WILL be seen as changed and will therefore be updated, even if the user did not actually touch it at all.