Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Navigation problems with primefaces tree  RSS feed

Ice Carev
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i have a problem with navigating from a link in a primefaces tree menu to a specific page. The explanation is the following: I have a template with the following code :

then i have a leftMenu.xhtml with the definition of the left menu :

then i have an index.xhtml where i use the template :

For the TreeNode navigation i have a class TreeMenuBean :

and this is the LinkBean class :

I have a faces-config.xml file with the navigation rules :

i had to put a "*" in the from-view-id tag to be able to navigate to the pages specified with the navigation cases. If i put /templates/leftMenu.xhtml insted of * then the navigation doesn't work and i get the error "WARNING:
JSF1064: Unable to find or serve resource, /deleteDepartment-page.xhtml."

Why is this so ?
Tim Holloway
Posts: 18713
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are 2 things in JSF that look almost identical, but refer to 2 very different things.

A URL path. For example, http://

A Resource path. For example, /templates/other.xhtml

A URL is what the client uses to send a request to the server. A Resource is a "file" (see below) that is part of the WAR used to satisfy the URL request. In the case of a JSF View, the FacesServlet tears down a URL such as http://myhost:8080/mywebapp/templates/other.jsf" and constructs the corresponding template resource path /templates/other.xhtml.

Navigation uses the local URL path, not the resource path. So it would be /templates/other.jsf, assuming you're using the "*.jsf" facelet pattern model.

Note that I said "file". In actuality, a WAR is a single ZIP file and so the resource is just one of the files in the ZIP file, not an actual OS file. That's assuming that your web server doesn't explode the WAR into actual files, which many webapp servers so, either by default or as an option.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!