Skip to main content

What's (on) your menu ?

Imagine a restaurant which serves great food, preferably your own favorite restaurant. Now imagine that this same restaurant, has your own personalized menu. Wouldn't that be great. You could just go there and eat whatever you feel like at that moment.

The same goes for the application you build. If you use ADF-Faces and a panelpage with menu facets to show the menu in your application, the framework tells you how your menu works, and almost what it looks like.

So this is what my menu looked like.

The ADF-faces menu has a couple of annoying features. First of all the size of the Menubar. If you have about 10 menu items (or less but with very long labels) the end users have to scroll to the right to see all items. You would easily miss the menu items on the far right. End users just love the pulldown menu's that they are used to. They use it in OracleForms, they use it in TwoLetterWord Office, and so on.

Secondly, the faces-config, in which the menu is configured will load only once.
Immagine what could happen if your menu is being constructed from a database table with roles and permissions per user: "An admistator revokes permission from a given users, and tells him to log off the system to activate this new privilige". Say what ?!. I'll explain this in a later post, and I will describe how to implement database driven menu security.

Here is how the pulldown menu can be implemented.

Copy lib's to be able to use myfaces menu.

Create the namespace, xmlns:t=""
Create an extension filter in the web.xml

And this is my new menu.

So what about the "own personalized menu" that I mentioned in the beginning of this post ? I even found a way to fix that. Not rocketscience though; just use a switcher in the menu facets and add a "Customizer" to your application. Your menu and your look and feel wil change "on the fly". The customizer contains SelectOneChoice listboxes to set the values of skin and menutype:

<af:selectOneChoice label="Select Menu type"

And in the page you use the switcher to display either of the menutypes.

<f:facet name="menu2">
<af:switcher facetName="#{sessionScope.menuType}"
<f:facet name="ADF-Faces">
<af:region id="menu2"
<f:facet name="My-Faces">
<af:region id="menu7"

After that it works just great. Below you see the 'deault' ADF look and feel.

And when you set your "own" customizations, here's what you get:

I really had fun creating this, and after showing this to some of my coworkers, even they liked it ;-)


Seb said…

Interesting post... Would you mond sharing the sample application ?

luc bors said…
Hi Seb,

I'll be in London for the next couple of days (Oracle Develop; see
Let me know what you are interested in. If it's the menu, or the switching,or both. I have to strip some (confidential) code from te sample application, but after that,I'll be glad to share it !
Give me some time to fix this.
Lucas said…
Hi Luc,

That is great article! Thanks for sharing this. I like your style of writing - building the story in a very comprehensive way.


luc bors said…
Thanks for your kind words Lucas !
Wilson said…
Hi Luc,

Thanks for sharing this.

Could you share a sample application ?

Thanks again,

luc bors said…
Sorry guys,

The silence has a reason.
I'll be back in about one week !
I'm enjoying some private time with my family.
B Vimalan said…

Please send step by step to create pull down menus. Share the doc as well as code.

Thanks & Regards
Vimalan Balan
Anonymous said…
Hi Luc
Can we set menu1 facet in panelpage left justified instead of right justified.
Will said…
Hi Luc,

Very interesting - Could you please share a sample application? I am interested in both the menu and switcher.

Thanks a lot!
luc bors said…
Hi you all. I've just started a new job so I was very busy. You can download a sample here. Navigation isn't working the way it should, but you'll get the idea. Maybe I'll be able to fix it.

Popular posts from this blog

ADF 12.1.3 : Implementing Default Table Filter Values

In one of my projects I ran into a requirement where the end user needs to be presented with default values in the table filters. This sounds like it is a common requirement, which is easy to implement. However it proved to be not so common, as it is not in the documentation nor are there any Blogpost to be found that talk about this feature. In this blogpost I describe how to implement this.

The Use Case Explained
Users of the application would typically enter today's date in a table filter in order to get all data that is valid for today. They do this each and every time. In order to facilitate them I want to have the table filter pre-filled with today's date (at the moment of writing July 31st 2015).

So whenever the page is displayed, it should display 'today' in the table filter and execute the query accordingly. The problem is to get the value in the filter without the user typing it. Lets first take a look at how the ADF Search and Filters are implemented by the f…

ADF 12.2.x : Conditional Showing Message Instead of List of Values Popup

Today I had to fix an issue in one of our ADF applications. For those of you working with ADF (as I do too occasionally) this might be valuable, so I decided to share this. The application is based on an old Oracle Forms applications and I had to implement the following functionality:

FRM-41830 : List of Values contains no entries.

In other words (more ADF like) : If you are about to render a List of Values and that List of Values contains no rows, just show a message instead of showing the List of Values.

In this post I will describe how I was able to implement this although it turned out to be a challenge.
Below are the steps that I took. Note that the Application can be downloaded from GIT.

1) I use a UI pattern where we use readonly table and do edits in a popup. That means that any List of Values will add an additional popup to the UI.

2) The List of Values that I use in this sample only shows entries where the minimum salary is less then the employees current salary. Not that …

ADF 11g Quicky 3 : Adding Error, Info and Warning messages

How can we add a message programatically ? Last week I got this question for the second time in a months time. I decided to write a short blogpost on how this works.

Adding messages is very easy, you just need to know how it works.
You can add a message to your faces context by creating a new FacesMessage. Set the severity (ERROR, WARNING, INFO or FATAL ), set the message text, and if nessecary a message detail. The fragment below shows the code for an ERROR message.

1: public void setMessagesErr(ActionEvent actionEvent) {
2: String msg = "This is a message";
3: AdfFacesContext adfFacesContext = null;
4: adfFacesContext = AdfFacesContext.getCurrentInstance();
5: FacesContext ctx = FacesContext.getCurrentInstance();
6: FacesMessage fm =
7: new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, "");
8: ctx.addMessage(null, fm);
9: }

I created a simple page with a couple of buttons to show the result of setting the message. When the butto…