Tuesday Mar 30, 2010

Working with Backing Beans in JDeveloper - The Right Way

One nice feature that was in JDeveloper for a long time is the ability to automatically expose every component on your JSF page in a backing bean. While this is a nice "work saving" feature, you shouldn't be using this one in most cases.
The reason is that it will create objects in your backing bean code for a lot of items you don't actually need to manipulate, making your code bigger and more complex to maintain.

The right way of working is to expose only components you need in your backing bean - and JDeveloper makes this just as easy through the binding property in the property inspector and the edit option it has.

Here is a quick video showing you how to do that:

Thursday Jul 09, 2009

Exploring the New ADF Faces Hierarchy Viewer

One of the new JSF components introduced in Oracle JDeveloper 11g is the Hierarchy Viewer (or HV for short).
Visually this is definitely one of the more impressive components in the ADF Faces set of components. It uses flash to render hierarchical relationships in a nice layout.

I played around with it for various demos I developed (including the 11g launch demo). While it is very easy to get started with it there are some tips to get exactly the look you want. I gathered a few tips on how to quickly build and customize your HV in this the following video tutorial

The basic thing to understand is that the component itself is a container component and you can play with the data you show in it by using the normal layout and common components available with ADF Faces. Also note that the default layout uses a lot of inline styles for fonts and fields - and you might want to change those as well.

Here is a basic 10 minute video tutorial on using the HV :
(Note - the video got cut while transferring it to YouTube - the part at the end would have shown you that you can access the cards through the structure pane and edit their content to show whatever you want, you can also add and remove cards).

More information on this component is in the ADF Faces hosted demo (see the features tab), the source code of the demo and the documentation.

Wednesday Jan 28, 2009

When-Validate-Item trigger in ADF with PPR

Here's a common thing that many Forms developers who move to ADF run into - you have a field that is a code and you want to display the translation of the code in the field next to it when the code is entered. In forms you use the when-validate-item trigger to do this usually.

Well in ADF one way to do it is to define a view object that is based on the Entity object of both the core and code tables. For example a VO that is based on Employees as the updateable EO and on Departments as a reference EO that is used to translate the deptId in the Employee table.
Once you did this - you want to add the ability in your JSF ADF page to populate the description field with the department name once someone fills out the departmentId.

Here is a quick demo of how you would do this - it's a very basic partial page rendering technique:

[update 2013 - there is an even simpler way to do PPR see here.]

If you are reading this blog there is a good chance that you might be interested to learn about the LOV feature of ADF - might make for a better UI. See these entries: cascading LOVs,LOVs for parameters, and part two of the above solution where you can type the description and get the code.

Monday Dec 03, 2007

Regular Expression Validation in JSF

When most people look at the list of components in ADF Faces they mostly focus on the visual components - and that's understandable, but if you look closer you'll find that there are also non-visual components included such as several validators.

Here is an example of one useful validator - the regular expression validator.

Let's suppose that you want your JSF field to allow only Numeric values - all you need to do is add to it the ADF Faces provided regular expression validator and then provide the right regex format.
For Example:

<af:inputText label="Label 1" autoSubmit="true">

 <af:validateRegExp pattern="[0-9]{1,10}"

                               noMatchMessageDetail="Only Numbers Please"/>


<af:commandButton text="commandButton 1"/>

Now run your page and try entering characters to the field and leaving it.
You'll immediately get an error message with the text you provided (implemented using Javascript).


Just one more thing that ADF Faces give you to make life easier...


I'm a Director of Product Management for Oracle's Cloud Development Tools and Frameworks.
Follow me:

« July 2016