File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes What is declarative navigation? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "What is declarative navigation?" Watch "What is declarative navigation?" New topic

What is declarative navigation?

dennis deems
Ranch Hand

Joined: Mar 12, 2011
Posts: 808
Every time I try to learn about JSF I encounter this term, without any explanation of what it is. Could someone please explain?
J Miller
Ranch Hand

Joined: Oct 21, 2010
Posts: 79
Anybody correct me if I'm wrong on this but...

From my understanding declarative navigation is when you declare in the config files where you will go if you click a particular button. For instance, on your actual jsf page you might have a button that looks like this:

Then in your config.xml files you'll have something like this:

So in your button you're not actually hard-coding the location of a file, but rather a string. Your config files know that whenever that particular string gets returned, it should send you to whatever place you have set up in your xml files.

That's my understanding anyway, somebody please let me know if I'm wrong.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

"Declarative" anything in programming terms means that instead of Java code (or whatever language), you're defining something in a simpler, less flexible way. Declarative notation normally has no conditional constructs[*] and the overall syntax is simpler, making it easier to validate the declarations than it would be to debug Java code.

I put the asterisk [*] next to "no conditional constructs" because you can make a navigational rule conditional (contingent on an EL expression result), but what I mean is that the individual navigational rules themselves support nothing like an if/then/else or do/while structure.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: What is declarative navigation?
It's not a secret anymore!