cpliu338
cpliu338

Reputation: 647

Omnifaces extensionless URLs and h:link

According to http://showcase.omnifaces.org/facesviews/ExtensionlessURLs by default, all URLs generated by ViewHandler.getActionURL(FacesContext, String), which is used by among others

<h:form>, <h:link>, <h:button> 

and all extended tags, will also be extensionless.

I try using this by putting Facelets source files into /WEB-INF/faces-views directory.

I typed /context/entries in the browser and I got the page in /WEB-INF/faces-views/entries.xhtml. But when I used this in my facelet page:

<h:link outcome="entries">Entries</h:link>

The url resulted is /context/WEB-INF/faces-views/entries.xhtml which is not the desirable result. What went wrong?

I am using Mojara 2.2.12 and Omnifaces 2.6.9 and my faces servlet mapping is *.jsf.

Upvotes: 2

Views: 184

Answers (2)

BalusC
BalusC

Reputation: 1109292

There was a small mistake in FacesViews of specifically 2.6.9 which is fixed in 2.7-SNAPSHOT. While working on getting FacesViews to support folders with periods in names such as /foo.bar/baz, I have accidentally committed a part of the fix into 3.x only instead of into 2.x. That explains why it works just fine in 3.1, as demonstrated by the "viewsdemo" showcase. My mistake, this just proves again that I'm a human and not a machine.

There are a few options to get around this:

  1. Downgrade to 2.6.8.
  2. Or, migrate to 3.1.
  3. Or, keep 2.6.9 and use the "Minimal configuration" approach of a single web.xml context parameter instead of "Zero configuration" approach of placing files in /WEB-INF/faces-views.

Upvotes: 4

cpliu338
cpliu338

Reputation: 647

BalusC is right, switching to version 2.6.8 solves the problem. The credit is BalusC's as always, but he has too much credit so I think he wouldn't mind that I posted an answer myself, just don't want to bother him.

Change the servlet mapping to *.xhtml also solves the problem. With all due respect, Xtreme Biker: a bug is a bug. Even if I change the mapping to *.abc there should not be a problem.

Upvotes: 0

Related Questions