如何在JSF中禁用jftfdi jffi查询参数 [英] How to disable jftfdi jffi query params in JSF
问题描述
我尝试了JavaServer Faces 2.2(Mojarra 2.2.4)的最新版本 并注意到以这种不需要的方式更改了我的查询字符串:
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=
代替
page.jsf
我发现这是新的JSF 2.2功能.但是这些查询参数(jftfdi,jffi)破坏了我对SEO友好的网址.如何禁用它?
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?
推荐答案
这是Mojarra中的错误.如果无法进行任何流导航配置(通过新的@FlowScoped
注释和<j:flow-xxx>
标签).
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).
基本上,负责<h:link>
和<h:button>
的HTML输出生成的OutcomeTargetRenderer
类错误地检查了 javadoc 基本实现永远不会返回null
,而是一个空字符串.因此,渲染器始终认为它在流导航的中间,并且始终附加关联的jftfdi
和jffi
请求参数.解决方法是让它也检查是否返回非空字符串.
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.
我将其报告为 issue 3054 ,他们确认这是一个错误,并且目前正在研究中.该修补程序可能会在Mojarra 2.2.5中提供.
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.
更新:截至目前,不到一天,它已针对2.2.5进行了固定.
Update: as of now, less than a day later, it's fixed for 2.2.5.
顺便说一句, jftfdi
代表"javax.faces
到流文档ID",它在
By the way, the jftfdi
stands for "javax.faces
To Flow Document ID" which is specified as follows in the javadoc:
由组件家族
javax.faces.OutcomeTarget
的渲染器渲染的组件必须使用此常量作为参数名称的参数名称,该参数表示该组件将导致输入的流的定义文档ID.
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.
和 jffi
代表在javax.faces流ID" ="noreferrer"> javadoc :
and the jffi
stands for "javax.faces
Flow ID" which is specified as follows in the javadoc:
由组件家族
javax.faces.OutcomeTarget
的渲染器渲染的组件必须使用此常量作为参数名称,该参数代表表示将导致输入该组件的流的流ID的参数.
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.
这篇关于如何在JSF中禁用jftfdi jffi查询参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!