• Post Reply Bookmark Topic Watch Topic
  • New Topic

Navigation Rule Question

 
Mike London
Ranch Hand
Posts: 1290
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using the 2.0 version of the Core JSF book and a navigation rule like this gives an error if I (accidentally) create a 2.2 XSD faces-config.xml:

(from chapter 3):



Works ok if XSD is set to 2.0 as it is in the book.

----

My question is then, is it better to use the navigation rule builder in an IDE to abstract these navigation rule (XSD) differences or do you just need to really understand the XSD for every single JSF version? (sigh.)

Thanks,

- mike
 
Tim Holloway
Bartender
Posts: 18415
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The more accurate name for "XSD" is "XML Schema". And I would have found it surprising that JSF 2.2 would have dropped this feature, but I'm wondering if it actually has or if it simply tightened up the schema definition. I'm too lazy to check at the moment, though. :)

You are attempting to navigate to a webapp resource. That is, an ".xhtml" file. Unless I've gotten my wits more scrambled than usual, that shouldn't have ever worked, because JSF navigates to a (app-relative) URL.

Resource paths and URL paths look a lot alike, since they have similar syntax rules. However, a URL works when you type it in a browser and a resource path does not. If I type in a resource path of "/images/smile.jpg" in a browser, what I'm actually typing in is a URL path of "/images.jpg", but the webapp scans that URL and routes it to the default servlet which converts the URL path to an identical resource path, opens the resource and copies its contents to the response stream. I could have just as easily have defined a servlet and mapped it to the URL pattern "/images/*", then made that servlet construct random images on the fly.

So, in other words, a more proper rule would look like this:


Which I believe can be further truncated to this in JSF 2.0 and later:



That's owing to the navigation enhancements that will add missing components as well as support direct navigation from an action method's return value without an explicit faces-config mapping.

As I said, this is a JSF application-relative URL, so use of navigation rules doesn't work to navigate to non-JSF URLs, whether it's within the current webapp or to any external webapp (JSF or otherwise).
 
Mike London
Ranch Hand
Posts: 1290
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim, great information.

I really like your tag line about Customer Surveys. :)

- mike
 
Tim Holloway
Bartender
Posts: 18415
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike London wrote:

I really like your tag line about Customer Surveys.

- mike


That could set me off on a long tirade about companies who'd rather rely on Big Data than maintain a personal business relationship between long-term employees and customers. Not to mention how annoying/usless those surveys are.

Bu I'll spare you.
 
Mike London
Ranch Hand
Posts: 1290
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:
Mike London wrote:

I really like your tag line about Customer Surveys.

- mike


That could set me off on a long tirade about companies who'd rather rely on Big Data than maintain a personal business relationship between long-term employees and customers. Not to mention how annoying/usless those surveys are.

Bu I'll spare you.


John Dvorak posted a great article on big data on PC Magazine:

http://www.pcmag.com/article2/0,2817,2455435,00.asp

In my view, the article is point on.

Thanks,

- mike

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!