Question

I tried the last version of JavaServer Faces 2.2 (Mojarra 2.2.4) and noticed changing my query string in this unwanted way:

page.jsf?jftfdi=&jffi=

instead of

page.jsf

I've found that it is the new JSF 2.2 feature. But these query params(jftfdi, jffi) spoil me SEO-friendly urls. How can I disable it?

Was it helpful?

Solution

This is a bug in Mojarra. They should not have been appended when there's no means of any flow navigation configuration (by the new @FlowScoped annotation and <j:flow-xxx> tags).

Basically, the OutcomeTargetRenderer class who's responsible for HTML output generation of the <h:link> and <h:button> is incorrectly checking if NavigationCase#getToFlowDocumentId() returns non-null before appending the flow navigation parameters. However, based on the javadoc the base implementation never returns null, but an empty string. Therefore, the renderer always thinks that it's in middle of a flow navigation and always appends the associated jftfdi and jffi request parameters. The fix is to let it check as well if it returns a non-empty string.

I reported it as issue 3054 and they confirmed that this is a bug and are currently working on it. The fix will likely be available in Mojarra 2.2.5.

Update: as of now, less than a day later, it's fixed for 2.2.5.


By the way, the jftfdi stands for "javax.faces To Flow Document ID" which is specified as follows in the javadoc:

Components that are rendered by Renderers of component-family javax.faces.OutcomeTarget must use this constant as the parameter name for a parameter representing the defining document id of the flow that this component will cause to be entered.

and the jffi stands for "javax.faces Flow ID" which is specified as follows in the javadoc:

Components that are rendered by Renderers of component-family javax.faces.OutcomeTarget must use this constant as the parameter name for a parameter representing the flow id of the flow that this component will cause to be entered.

OTHER TIPS

I had the same error before. The origin of this bug is the version of jsf. Just try to upgrade version to 2.2.5 like this :

    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.2.5</version>
    </dependency>
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>2.2.5</version>
    </dependency> 

Hope it's helpfull

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top