This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JSF and the fly likes Navigation rule not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Navigation rule not working" Watch "Navigation rule not working" New topic

Navigation rule not working

Scott Stephens

Joined: Jun 25, 2011
Posts: 23

I have a string literal "LOGOUT" as action that should trigger a navigation rule:

Here the faces-config.xml

the first rule for navigation to the right page following login works good. My logout <t:commandNavigation ´... action="LOGOUT"> however doesnt. The browser URL shows only http://localhost:8080/Perso/index.xhtml#
What is wrong? Maybe someone has an idea.
Scott Stephens

Joined: Jun 25, 2011
Posts: 23

I wrapped the navigation panel with a <h:form> tag . Now it works. Apparently, a POST OR GET REQUEST is necessary to send the string literal to the web server. I assume this is taken care of by the <h:form> tag.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17161

You are correct. JSF operates primarily via a series of postback operations done via HTTP POST. For HTTP POST, a form must exist, and to get the extra indicators that help JSF process propertly, it should be a JSF "h:form" or equivalent and not a bare HTML FORM tag with ACTION=POST on it.

This is true even for "hyperlink" tags such as h:commandLink and for menu tags, since, unlike bare HTML A HREF= tags, they will go through the JSF postback engine.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Navigation rule not working
It's not a secret anymore!